Page 1 of 1

Regexp exclusions

Posted: Tue Sep 23, 2003 5:20 pm
by acogan
First, I confess I haven't read through all the posts on this forum, and further I'm not a regexp master.

That said, I'd like the pattern exclusion in TextPad enhanced so that you can specify not to match a string, rather than just single chars. Right now, you can exclude a list or a range of individual characters. Like, to not match x, y, or z:

Code: Select all

[^x-z]
What I'd like to see is some type of extension that would let me exclude a string of chars, like:

Code: Select all

[^"foo"]
Of course, the problem with the above is that you'd really need some escaped character instead of normal quotes, but hopefully you get the idea.

Posted: Tue Sep 23, 2003 7:09 pm
by Bob Hansen
Expressions already exist to help with that, but TextPad does not support them at this time. That could probably be done by adding the 4 lookaround expressions of:
Positive lookahead (?=.....) successful if it can match to the right

Negative lookahead (?!.....) successful if it can NOT match to the right

Positive lookbehind (?<=.....) successful if it can match to the left

Negative lookbehind (?<!.....) successful if it can NOT match to the left
Using these in conjunction with word boundary expressions \< and \> should provide an additional level of Search/Replace functions.

Add a poll, I would definitely vote for this.