in reply to lookaround assertions

my ($ga) = $str =~ /VALUE="([^"]+)" SELECTED/;

Replies are listed 'Best First'.
Re: Re: lookaround assertions
by pbeckingham (Parson) on Apr 01, 2004 at 14:06 UTC

    That regex needs to be made case insensitive, matching the underlying HTML. Note also that the regex still assumes that the VALUE attribute and SELECTED property appear in the given sequence, that the white space is strictly as expected, and that double quotes are used.

    These kind of assumptions are only going to be valid if you are absolutely sure of the format of the HTML, otherwise you will need to parse properly.

      All these complications... I was just thinking of doing
      my ($ga) = ($str =~ /(\bGA\b)/)
      Of course, while this solves the question in the post, it may not do what the author wants ;).