Some people use "^" and "$" in regular expressions to mean beginning-of-the-string or end-of-the-string. However, they can mean beginning-of-a-line and end-of-a-line respectively using the /m
flag which is confusing. It's a good idea to use \A
for start-of-string and \z
for end-of-string always (assuming they are supported by the regex syntax), and to specify the /m
flag if one needs to use "^" and "$" for start/end of a line.