in reply to Re: Regexp - match if not between [ ]
in thread Regexp - match if not between [ ]

Look-behind is problematic, for the number of digits etc. are not fixed. But thanks. I was really thinking in the wrong direction.

  • Comment on Re^2: Regexp - match if not between [ ]

Replies are listed 'Best First'.
Re^3: Regexp - match if not between [ ]
by BrowserUk (Patriarch) on May 30, 2011 at 15:53 UTC
    Look-behind is problematic, for the number of digits etc. are not fixed.

    Look behinds can still accommodate the task, but it does get pretty unwieldy if the width variation is more than a few characters:

    print for split m[ (?<! Cf ) (?: (?<! \w\d\d\d ) | (?<! \w\d\d ) | (?<! \w\d ) ) \. (?! [ ^\] ]+ \] ) ]x, $s;; The fox did it[ at 12.23 ] well, Cf. 23 A423.23 The swallow was even better,

    But it sounds like you've settled on a solution.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.