in reply to Re: Perl's regexp (?{...}) construct and constraining matches.
in thread Perl's regexp (?{...}) construct and constraining matches.

Thanks diotalevi, I was struggling to come up with guaranteed failure condition. \w\b\w works, but your solution is more elegant.

Implementing your suggestions, the regexp now looks like:

m/$find(?(?{not(pos()<=length($_)*.5)})(?!))/

Starting to look a little saner.


Dave

Replies are listed 'Best First'.
Re^3: Perl's regexp (?{...}) construct and constraining matches.
by Aristotle (Chancellor) on Aug 14, 2004 at 19:26 UTC

    Of course, as with everything else, sanity is relative… :-)

    Makeshifts last the longest.

Re^3: Perl's regexp (?{...}) construct and constraining matches.
by diotalevi (Canon) on Aug 16, 2004 at 12:25 UTC
    You know, would it kill you to call your mother? She's been waiting to tell you your regexes need more whitespace.