I have a string variable with several newlines, and I would like to check if the beginning of the string matches the regular expression. However, when I use the ^ character, it matches the text that starts with each new line.
I want this to fit:
"foo\nbar" =~ /^foo/
and I want it to not match
"bar\nfoo" =~ /^foo/
I can not find a modifier that makes the ^ character (or any other) match only the beginning of the line. Any help was greatly appreciated.
ruby regex
cabird
source share