Why (?<!peer.*)210 does not work in UltraEdit search?

Why (?<!peer.*)210 does not work in UltraEdit search?

2
NewbieNewbie
2

    Sep 06, 2016#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?

    6,603548
    Grand MasterGrand Master
    6,603548

      Sep 07, 2016#2

      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 an UC/UE/UES for Windows user from Austria

      18672
      MasterMaster
      18672

        Sep 07, 2016#3

        Hi,

        perhaps this is what you are looking for:

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

        BR, Fleggy

        2
        NewbieNewbie
        2

          Sep 07, 2016#4

          Fleggy, yes it is, thanks, you are great.

          18672
          MasterMaster
          18672

            Sep 07, 2016#5

            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