learn-regex
learn-regex copied to clipboard
$ is problematic
This is a pet of mine – in (almost all) regex engines, $
means "end of input possibly preceded by a newline", whereas \z
means "end of input".
It would be worth stating the difference here, as using $
can lead to broken validation regexes (consider the harm of being able to inject newlines in places they aren't expected, or being able to put an additional character after length validation, for example).