R
rjb
Hi!
Could somebody have a look and help me to optimize the code below.
It may look like very bad way of coding, but this stuff is very, very new
for me.
I've included just few lines.
Regex regxUserName = new Regex(@"(?<=User-Name = )\""([^\""]+)\""",
RegexOptions.None);
Regex regxSessionId = new Regex(@"(?<=Acct-Multi-Session-Id
= )\""([^\""]+)\""", RegexOptions.None);
Regex regxInputGigawords = new Regex(@"(?<=Acct-Input-Gigawords = )\w*",
RegexOptions.None);
..
..
..
Match mt = regxUserName.Match(sb.ToString());
strUserName = mt.Groups[1].ToString();
Match mt2 = regxSessionId.Match(sb.ToString());
strSessionId = mt2.Groups[1].ToString();
Match mt3 = regxInputGigawords.Match(sb.ToString());
strInputGigawords = mt3.Groups[0].ToString();
..
..
..
I'm using this to extract data from the following file.
Mon Sep 27 22:17:15 2004
Acct-Status-Type = Interim-Update
User-Name = "0007933B22B9"
NAS-IP-Address = 192.168.10.40
Service-Type = DATA
Acct-Multi-Session-Id = "147738"
Acct-Session-Id = "3"
Acct-Delay-Time = 0
Event-Timestamp = 1096323434
Acct-Session-Time = 153766
Acct-Input-Gigawords = 0
Acct-Output-Gigawords = 0
Acct-Input-Octets = 17970689
Acct-Output-Octets = 8331353
Acct-Terminate-Cause = 0
Framed-IP-Address = 0.0.0.0
Acct-Input-Packets = 0
Acct-Output-Packets = 0
NAS-Port-Type = Async
NAS-Port-Id = 0
thank you
rjb
Could somebody have a look and help me to optimize the code below.
It may look like very bad way of coding, but this stuff is very, very new
for me.
I've included just few lines.
Regex regxUserName = new Regex(@"(?<=User-Name = )\""([^\""]+)\""",
RegexOptions.None);
Regex regxSessionId = new Regex(@"(?<=Acct-Multi-Session-Id
= )\""([^\""]+)\""", RegexOptions.None);
Regex regxInputGigawords = new Regex(@"(?<=Acct-Input-Gigawords = )\w*",
RegexOptions.None);
..
..
..
Match mt = regxUserName.Match(sb.ToString());
strUserName = mt.Groups[1].ToString();
Match mt2 = regxSessionId.Match(sb.ToString());
strSessionId = mt2.Groups[1].ToString();
Match mt3 = regxInputGigawords.Match(sb.ToString());
strInputGigawords = mt3.Groups[0].ToString();
..
..
..
I'm using this to extract data from the following file.
Mon Sep 27 22:17:15 2004
Acct-Status-Type = Interim-Update
User-Name = "0007933B22B9"
NAS-IP-Address = 192.168.10.40
Service-Type = DATA
Acct-Multi-Session-Id = "147738"
Acct-Session-Id = "3"
Acct-Delay-Time = 0
Event-Timestamp = 1096323434
Acct-Session-Time = 153766
Acct-Input-Gigawords = 0
Acct-Output-Gigawords = 0
Acct-Input-Octets = 17970689
Acct-Output-Octets = 8331353
Acct-Terminate-Cause = 0
Framed-IP-Address = 0.0.0.0
Acct-Input-Packets = 0
Acct-Output-Packets = 0
NAS-Port-Type = Async
NAS-Port-Id = 0
thank you
rjb