I have a string variable that has multiple newlines in it and I'd like to test if the beginning of the string matches a regular expression. However, when I use the ^
character, it matches against text that begins at each newline.
I want this to match:
"foo\nbar" =~ /^foo/
and I want this to not match
"bar\nfoo" =~ /^foo/
I can't find a modifier that makes the ^
(or any other) character match only the beginning of the string. Any help greatly appreciated.