\Z in regular expressions #86

atombender opened this Issue Mar 24, 2012 · 1 comment


None yet
3 participants

\Z is actually equivalent to:


In other words, it matches a line ending at the end of the string. Not necessarily what you want, although probably rarely harmful.

The correct regexp syntax to match the absolute end of the string is \z.


This comment has been minimized.

Show comment
Hide comment

JuanitoFatas Apr 1, 2012


If you want to match the whole string use: \A and \z.

+ 1


JuanitoFatas commented Apr 1, 2012

If you want to match the whole string use: \A and \z.

+ 1

@bbatsov bbatsov closed this in 32cb8c6 Apr 9, 2012

marocchino pushed a commit to marocchino/ruby-style-guide that referenced this issue Aug 11, 2015

shyouhei pushed a commit to shyouhei/ruby-style-guide that referenced this issue Nov 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment