lib/regex.rb in twitter-text-1.1.7 vs lib/regex.rb in twitter-text-1.1.8
- old
+ new
@@ -33,11 +33,12 @@
major, minor, patch = RUBY_VERSION.split(/\./)
if major.to_i >= 1 && minor.to_i >= 9
REGEXEN[:list_name] = /[a-zA-Z][a-zA-Z0-9_\-\u0080-\u00ff]{0,24}/
else
- REGEXEN[:list_name] = /[a-zA-Z][a-zA-Z0-9_\-\x80-\xff]{0,24}/
+ # This line barfs at compile time in Ruby 1.9.
+ REGEXEN[:list_name] = eval("/[a-zA-Z][a-zA-Z0-9_\\-\x80-\xff]{0,24}/")
end
# Latin accented characters (subtracted 0xD7 from the range, it's a confusable multiplication sign. Looks like "x")
LATIN_ACCENTS = [(0xc0..0xd6).to_a, (0xd8..0xf6).to_a, (0xf8..0xff).to_a].flatten.pack('U*').freeze
REGEXEN[:latin_accents] = /[#{LATIN_ACCENTS}]+/o
@@ -58,10 +59,10 @@
# 2. Used in IIS sessions like /S(dfd346)/
REGEXEN[:wikipedia_disambiguation] = /(?:\(#{REGEXEN[:valid_general_url_path_chars]}+\))/i
# Allow @ in a url, but only in the middle. Catch things like http://example.com/@user
REGEXEN[:valid_url_path_chars] = /(?:
#{REGEXEN[:wikipedia_disambiguation]}|
- @[^\/]+\/|
+ @#{REGEXEN[:valid_general_url_path_chars]}+\/|
[\.\,]?#{REGEXEN[:valid_general_url_path_chars]}
)/ix
# Valid end-of-path chracters (so /foo. does not gobble the period).
# 1. Allow =&# for empty URL parameters and other URL-join artifacts
REGEXEN[:valid_url_path_ending_chars] = /[a-z0-9=#\/]/i