1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[DOC] \s in regexp is not same as in string [ci skip]

This commit is contained in:
Nobuyoshi Nakada 2019-11-03 22:53:17 +09:00
parent 782d1b8fb0
commit f8b3d7d159
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -69,7 +69,8 @@ a backslash literally, backslash-escape it: <tt>\\\\</tt>.
/a\\\\b/.match('a\\\\b') #=> #<MatchData "a\\b">
Patterns behave like double-quoted strings so can contain the same
backslash escapes.
backslash escapes (the meaning of <tt>\s</tt> is different a little however,
see bellow[#label-Character+Classes]).
/\s\u{6771 4eac 90fd}/.match("Go to 東京都")
#=> #<MatchData " 東京都">