Permalink
Browse files

fixed #86 - \z instead of \Z for matching the absolute end of a string

  • Loading branch information...
1 parent a4a39ac commit 32cb8c6373e084ab4d498bd04be93d5037169830 Bozhidar Batsov committed Apr 9, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 README.md
View
@@ -1095,12 +1095,13 @@ syntax.
`^`, `-`, `\`, `]`, so don't escape `.` or brackets in `[]`.
* Be careful with `^` and `$` as they match start/end of line, not string endings.
- If you want to match the whole string use: `\A` and `\Z`.
+ If you want to match the whole string use: `\A` and `\z` (not to be
+ confused with `\Z` which is the equivalent of `/\n?\z/`).
```Ruby
string = "some injection\nusername"
string[/^username$/] # matches
- string[/\Ausername\Z/] # don't match
+ string[/\Ausername\z/] # don't match
```
* Use `x` modifier for complex regexps. This makes them more readable and you

0 comments on commit 32cb8c6

Please sign in to comment.