I am trying to play with regular expressions in python. I have framed regular expression as given below. I know that ^
is used to match at the beginning of search string. I have framed by match pattern which contains multiple ^
, but I am not sure about how re
will try to match the pattern in search string.
re.match("^def/^def", "def/def")
I was expecting that re
will be raising error, regarding invalid regular expression, but it doesn't raise any error and returns no matches.
So, my questions is "^def/^def"
or "$def/$def"
a valid regular expression ?