TJ

TJ

  • NA
  • 3
  • 0

Regex.split by a spceial ip address pattern?

Feb 24 2010 2:48 PM
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 = @"(?<!job-identifier)((?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?):?[0-9][0-9][0-9][0-9][0-9]?";

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?

Answers (2)