You've told it to match one character not an > (which 1 is), one or more digits (which 3 is), zero or more lower case letters (which nothing is), and one character that's not < (which a is). Wherein lies the problem?
And of course there's the standard jibe that in general you want to use something like HTML::TreeBuilder or the like to parse HTML, not regexen.
Update: Curse you, Red Baronmerlyn. :)
And a hopefully useful pointer: YAPE::Regex::Explain can be helpful for obtaining a prose explanation of just what your regex means. Using it on your regex produces this:
perl -MYAPE::Regex::Explain -le 'print YAPE::Regex::Explain->new( qr/( +[^>]\d+[a-z]*[^<])/ )->explain' The regular expression: (?-imsx:([^>]\d+[a-z]*[^<])) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- [^>] any character except: '>' ---------------------------------------------------------------------- \d+ digits (0-9) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- [a-z]* any character of: 'a' to 'z' (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- [^<] any character except: '<' ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
In reply to Re: Angle brackets and regex problem
by Fletch
in thread Angle brackets and regex problem
by emav
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |