in reply to Re: Help with Regular Expression matching
in thread Help with Regular Expression matching

As our friend notes, you mean:

my ($match) = $string =~ /(<ab>|ab)/;
Update: Ok, I didn't read the spec carefully enough, I think this will do it:
my ($match) = $string =~ /(?!<ab[^>]|[^<]ab>)<?(ab)>?/
But I'd probably split it into two regexes.

I'm talking twaddle, anyone else want a go?


davis
It's not easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.

Replies are listed 'Best First'.
Re: Re: Re: Help with Regular Expression matching
by Anonymous Monk on Feb 18, 2004 at 10:46 UTC
    This is close, but I don't want to capture the surrounding brackets.