[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: RE madness



On Mon, Jan 06, 2003 at 11:40:08PM -0200, andrej hocevar wrote:
> I've been playing around with these two REs in Perl with no
> success. Can anyone tell me what's wrong?

Derrick has nailed it, I believe, so I won't go over that again.

> which fails. Why is this? Is there no way of saying "neither/nor",
> just "either/or"?

Look into the "Extended Patterns" section of the perlre(1) man page.
Specifically, you probably want either (?!pattern) or (?<!pattern).
Beware that both of these are zero-width assertions, and, as such, can
behave a little unexpectedly. See the "Backtracking" section of the same
man page for the gory details.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: