in reply to Extract data from regex match where "." is newline?

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'