|
-
Dec 12th, 2006, 10:47 AM
#1
Thread Starter
Frenzied Member
[2.0] Regex - find a match NOT located between two chars
Let's say I have this line of text:
aaa c b aa b ax
and I want to match all strings of a's not located between matched b's so in this case the matches would be {aaa, a}
I'm trying this regular expression but it doesn't work:
(?<!b.*)a+(?!.*b)
I'm trying to tell it to match all strings of a's except "those preceded by a b and followed by a b."
What this expression really says is match all strings of a's except "those preceded by a b OR followed by a b."
aaa - followed by a b
aa - preceded and followed by a b
a - preceded by a b
I'm wondering if there's a way to specify both 'not preceded by' and 'not followed by'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|