If I run:
use strict; use warnings; my $tagl = do {local $/; <DATA>}; if($tagl =~ /<div class=\"soda.*?>(.*?)<\/div>/ism) { my $grp = $1; print "'$grp'\n"; } __DATA__ <div class="soda odd"> Power. Grace. Wisdom. Wonder. </div> <div class="soda even"> Wonder. Power. Courage. </div> <div class="soda odd"> The future of justice begins with her </div>
it prints:
' Power. Grace. Wisdom. Wonder. '
Maybe what you are trying to match or the regex you are using isn't what you have posted?
Note that parsing HTML/XML using regexen is generally a really bad idea. You've been told this several times already. Just in case you've forgotten why, you might like a refresher with Why a regex *really* isn't good enough for HTML and XML, even for "simple" tasks
In reply to Re: I match a pattern in regex, yet I don't get the group I wanted to extract for some reason
by GrandFather
in thread I match a pattern in regex, yet I don't get the group I wanted to extract for some reason
by SergioQ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |