However, since newlines are present, I have to OR with something that matches them
Not sure I understand. Normally, /s is sufficient for "." to also match newlines. No alternation required.
my $text = "<Master ID='42' NameU='foo\nbar'"; if ($text =~ /<Master ID='.*?' NameU='(.*?)'/s) { print "'$1'\n"; }
outputs (as expected)
'foo bar'
In reply to Re: Extract data from regex match where "." is newline?
by Eliya
in thread Extract data from regex match where "." is newline?
by dsayars
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |