class

Highlight::JSRe

Inherits Reference < Object

Обёртка над Regex с JS-семантикой global-exec: поиск с last_index, после пустого совпадения last_index = index + 1, при неудаче — сброс в 0.

Constructors

new(source : String, ignore_case : Bool = false)
Source

Class methods

char_advance(s : String, byte_index : Int32) : Int32

Смещение на один символ вперёд от байтового индекса (аналог +1 UTF-16-юнита)

Source
char_bytesize_at(s : String, byte_index : Int32) : Int32

Размер UTF-8 символа по байтовому смещению (byte_at — байтовый индекс)

Source
match_starts_with(re : Regex, lexeme : String) : Bool

exec + проверка, что совпадение начинается ровно с pos (JS: re.exec(lexeme) c match.index === 0 — «начинается с»)

Source

Instance methods

exec(s : String) : Regex::MatchData | Nil
Source
last_index
Source
last_index=(last_index : Int32)
Source
regex
Source