class Regex
class Regex
lib/regex.tya:2
Regex provides the regex/Regex standard library API.
Source
# Regex provides the regex/Regex standard library API.
class Regex
# Regex.pattern stores instance state.
# @type Nil
pattern: nil
# Regex.initialize stores a pattern.
# @param pattern String pattern value.
# @return Self the initialized object.
initialize: pattern ->
self.pattern = pattern
# Regex.compile compiles a reusable regex value.
# @param pattern String pattern value.
# @param options Dict options value.
# @return Any the resulting value.
compile: pattern = nil, options = {} ->
if self.pattern != nil
if pattern != nil
options = pattern
pattern = self.pattern
if options == nil
options = {}
regex_compile(pattern, options)
# Regex.match? returns whether pattern appears in text.
# @param pattern String pattern value.
# @param text String text value.
# @param options Dict options value.
# @return Boolean whether the condition is true.
match?: pattern, text = nil, options = {} ->
if self.pattern != nil
text = pattern
pattern = self.pattern
Regex(pattern).compile(options).match?(text)
# Regex.search returns the first match dictionary or nil.
# @param pattern String pattern value.
# @param text String text value.
# @param options Dict options value.
# @return Any the resulting value.
search: pattern, text = nil, options = {} ->
if self.pattern != nil
text = pattern
pattern = self.pattern
Regex(pattern).compile(options).find(text)
Instance Variables
pattern
Regex.pattern
lib/regex.tya:5
Regex.pattern stores instance state.
Source
# Regex.pattern stores instance state.
# @type Nil
pattern: nil
Methods
compile
Regex.compile(pattern = nil, options = {})
lib/regex.tya:17
Regex.compile compiles a reusable regex value.
Source
# Regex.compile compiles a reusable regex value.
# @param pattern String pattern value.
# @param options Dict options value.
# @return Any the resulting value.
compile: pattern = nil, options = {} ->
if self.pattern != nil
if pattern != nil
options = pattern
pattern = self.pattern
if options == nil
options = {}
regex_compile(pattern, options)
initialize
Regex.initialize(pattern)
lib/regex.tya:10
Regex.initialize stores a pattern.
Source
# Regex.initialize stores a pattern.
# @param pattern String pattern value.
# @return Self the initialized object.
initialize: pattern ->
self.pattern = pattern
match?
Regex.match?(pattern, text = nil, options = {})
lib/regex.tya:31
Regex.match? returns whether pattern appears in text.
Source
# Regex.match? returns whether pattern appears in text.
# @param pattern String pattern value.
# @param text String text value.
# @param options Dict options value.
# @return Boolean whether the condition is true.
match?: pattern, text = nil, options = {} ->
if self.pattern != nil
text = pattern
pattern = self.pattern
Regex(pattern).compile(options).match?(text)
search
Regex.search(pattern, text = nil, options = {})
lib/regex.tya:42
Regex.search returns the first match dictionary or nil.
Source
# Regex.search returns the first match dictionary or nil.
# @param pattern String pattern value.
# @param text String text value.
# @param options Dict options value.
# @return Any the resulting value.
search: pattern, text = nil, options = {} ->
if self.pattern != nil
text = pattern
pattern = self.pattern
Regex(pattern).compile(options).find(text)