Reputation: 189626
Python's re
module says this:
'^'
(Caret.) Matches the start of the string, and in MULTILINE mode also matches immediately after each newline.
I want to use MULTILINE but I want to require a match at the beginning of the string (not just the beginning of a line). Is there a way to do this?
Upvotes: 2
Views: 672
Reputation: 626738
Just use the \A
anchor that matches the start of string unambiguously.
Check the Regular Expression Syntax:
\A
Matches only at the start of the string.
Upvotes: 3