I could really use some assistance on this.
I'm attempting to perform a Regex.split() on a large string. The delimiter I've decided would return the most ideal result is IP address. However, it appears in two different forms. One form of the IP is preceded by a specific string, the other does not. The latter is what I need to use as the delimiter.
So, I need to exclude the IP address sequence which DOES include the preceding string. Here is my current regex pattern:
string ip_address_pattern = @"(?
The preceding string I need to look for is: job-identifier = "
That's 'job-identifier' followed by a space, an equal, another space and a quote.
Can someone tell me what I'm doing wrong?
Loading
TJPosted Feb 25, 2010, 10:06 AM
I'm getting a stream of log information from a printer/copier. That stream is a series of strings that looks like this:
"192.168.1.2:66327"
accounting-information = 47 65 6e 65 72 69 63 55 73 65 72 49 64 22 47 65 6e 65 72 69 63 41 63 63 6f 75 6e 74 49 64
accounting-information-avp = "USERID,GenericUserId"
accounting-information-avp = "ACCTID,GenericAccountId"
device-name = "FKA"
completion-time = 20100222161240
name = "FaxAutoReceive66327"
completed-reasons = "terminated"
job-type = "fax-receive"
num-phone-numbers = 1
job-identifier = "192.168.1.2:66327"
job-owner = ""
The stream contains an entry like above for each job printed.
What I'm trying to do is parse these strings into some kind of record I can insert into a database table.
To do that, I need to first separate the larger stream into individual jobs like above. The common delimiter is the IP address in quotes, followed by a port number.
However, that IP lives in TWO places within any given entry. Once at the *beginning* of an entry and once as a child value labeled as "job-identifier". (See the second to last line above)
My intent is to REGEX split on the IP sequence ONLY in the instance that is NOT preceded by "job-identifier".
kiran kumarPosted Feb 24, 2010, 8:40 PM
MARK THE ANSWER IF IT HELPS YOU