in reply to Re: regex pattern matches
in thread regex pattern matches
$ perl -E ' $text = q{asd<TAG>dsyuhf</TAG>urrh}; $item = $1 if $text =~ m{<TAG>([^<]+)</TAG>}; say $item;' dsyuhf $
Note also that I capture ([^<]+) because (.*) is greedy.
$ perl -E ' $text = q{asd<TAG>dsyuhf</TAG>urrh<TAG>dsvnnhf</TAG>urubb}; $item = $1 if $text =~ m{<TAG>(.*)</TAG>}; say $item;' dsyuhf</TAG>urrh<TAG>dsvnnhf $
I hope this is useful.
Cheers,
JohnGG
|
|---|