Class: JSRegexp
- Inherits:
-
Object
- Object
- JSRegexp
- Defined in:
- lib/jsregexp/version.rb,
lib/jsregexp/jsregexp.rb
Constant Summary collapse
- VERSION =
'0.1.0'
Class Method Summary collapse
Class Method Details
.convert(regexp) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/jsregexp/jsregexp.rb', line 2 def self.convert(regexp) regexp.inspect .sub('\\A', '^') .sub('\\Z', '$') .sub('\\z', '$') .sub(/^\//, '') .sub(/\/[a-z]*$/, '') .gsub(/\(\?#.+\)/, '') .gsub(/\(\?-\w+:/, '(') .gsub(/\s/, '') end |