in reply to Angle brackets and regex problem
If you what you want (as hinted by Re^2: Angle brackets and regex problem) is to match the longest match to /\d+[a-z]*/ which is not surrounded by > and <, you may say:
and it is going to say "No match". While using my $test = "blah 13a blah blah"; would resultmy $test = "blah <span class='small'>13a</span> blah blah"; if ( $test =~ /(.)(\d+[a-z]*)(.)/ && $1 ne '>' && $2 ne '<') { print "No tag found: $2\n"; } else { print "No match" }
No tag found: 13a
But if you want something more complex than this — like finding the content of XML tags which just contain text which matches /\d+[a-z]*/, listen to what merlyn said and use a HTML parser.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Angle brackets and regex problem
by emav (Pilgrim) on Jan 05, 2007 at 18:08 UTC |