Skip to content

Instantly share code, notes, and snippets.

@randym
Created September 16, 2012 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randym/3731106 to your computer and use it in GitHub Desktop.
Save randym/3731106 to your computer and use it in GitHub Desktop.
control character regex matching in ruby 1.8.7 vs 1.9.x
if RUBY_VERSION == "1.8.7"
nasty_control_char_matcher = Regexp.new("[\x01\x02\x03\x04\x05\x06\x07\x08\x1F\v\xE2]")
else
nasty_control_char_matcher = Regexp.new("[\x01\x02\x03\x04\x05\x06\x07\x08\x1F\v\u2028]")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment