Module: Interscript::OpalMapTranslate

Defined in:
lib/interscript/opal_map_translate.rb

Class Method Summary collapse

Class Method Details

.translate_regexp(src) ⇒ Object


3
4
5
6
7
8
9
10
# File 'lib/interscript/opal_map_translate.rb', line 3

def self.translate_regexp(src)
  src.
    gsub('[:upper:]', '\\\\\\\\p{Lu}').
    gsub('[:lower:]', '\\\\\\\\p{Ll}').
    gsub('[:alpha:]', '\\\\\\\\p{L}').
    gsub('(?<=[\\\\p{Lu}])?', '(?<=[\\\\\\\\p{Lu}]?)').
    gsub('(?=[\\\\p{Lu}])?', '(?=[\\\\\\\\p{Lu}]?)')
end