in reply to regex pattern matches
Use XML parser module; one among some is XML::LibXML.
If you insist, update your regex to account for the value between start & end tags ...
use v5.16.0; my $tag = 'tag'; my $string = '... <tag>value</tag>'; my $parse = qr{<$tag>(?<val>.*?)</$tag>}s; $string =~ $parse and say 'found: ', $+{'val'}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex pattern matches
by jellisii2 (Hermit) on Aug 22, 2014 at 14:57 UTC |