Created
January 11, 2010 23:26
-
-
Save mzsanford/274725 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
space = " " | |
japanese_space = [0x3000].pack('U') | |
puts "---" | |
puts "Space and \\s : #{!!space.match('\s')}" | |
puts "Japanese Space and \\s : #{!!japanese_space.match('\s')}" | |
puts "---" | |
puts "Space and [[:space:]] : #{!!space.match('[[:space:]]')}" | |
puts "Japanese Space and [::space:]] : #{!!japanese_space.match('[[:space:]]')}" | |
puts "---" | |
puts "Space and [[:punct:]] : #{!!space.match('[[:punct:]]')}" | |
puts "Japanese Space and [:punct:]] : #{!!japanese_space.match('[[:punct:]]')}" | |
# Output: | |
# --- | |
# Space and \s : true | |
# Japanese Space and \s : false | |
# --- | |
# Space and [[:space:]] : true | |
# Japanese Space and [::space:]] : false | |
# --- | |
# Space and [[:punct:]] : false | |
# Japanese Space and [:punct:]] : false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment