User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Find, replace, find in files, replace in files, regular expressions
5 posts Page 1 of 1
The text:

Code: Select all
: peeripaddress=10.20.227.210
 peer2fsafd=210
(92):
Schedtutler 2=210666666
213e=210
213ddress=10.20.227.sdfsdf210dsd
213address=10.20.227.vcxv210112
213address=10.20.227.210
213address=10.20.227.210

I want to find only 210 on lines not containing also the word peer, but (?<!peer.*)210 does not work in UltraEdit. But I tested the expression in Regular Expressions test tools and there it worked. So how to make it working?
The Perl regular expression library must be able on a lookbehind to find out how much characters it has to read back from beginning of found text to test against the lookbehind expression. With .* inside the lookbehind the number of characters to read back from position where 210 is found can't be determined. This Perl regular expression is therefore invalid. Please read on Lookahead and Lookbehind Zero-Length Assertions at least the section Important Notes About Lookbehind.
Best regards from Austria
Hi,

perhaps this is what you are looking for:

^(?=(?>.(?<!peer))*?210).*\K210

BR, Fleggy
Fleggy, yes it is, thanks, you are great.
The expression is unnecessarily complicated. The simpler version is:

^(?>.(?<!peer))*?\K210

But it works only if peer precedes 210, so if you want to find 210 on lines not containing peer at all then use this, please:

^(?>.(?<!peer))*?\K210(?=(.(?<!peer))*$)

BR, Fleggy
5 posts Page 1 of 1