Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 32cb8c6373e084ab4d498bd04be93d5037169830 1 parent a4a39ac
Bozhidar Batsov authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 README.md
View
5 README.md
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.