Regex
Enums
enum Flag with EqOrderToString
SourceType Aliases
type alias MatchQuery [ a : Type r : Eff ] = Matcher[r] -> Result[String, a] \ r
SourceMatchQuery is a read query applied to a the current match of a Matcher.
Definitions
def
breakAfterFirst
(
substr :
{ substr = Regex }
s :
String
)
: (String, String)
\ Pure
Find the first instance of Regex substr in string s, return a pair of the
prefix of string s up to and including sub and the rest of string s after sub.
def
breakBeforeLast
(
substr :
{ substr = Regex }
s :
String
)
: (String, String)
\ Pure
Find the last instance of substr in string s, return a pair of the
initial string including substr and suffix from substr.
def
breakOnFirst
(
substr :
{ substr = Regex }
s :
String
)
: (String, String)
\ Pure
Find the first instance of Regex substr in string s, return a pair of the
prefix of string s up to sub and the rest of string s including sub.
def
breakOnLast
(
substr :
{ substr = Regex }
s :
String
)
: (String, String)
\ Pure
Find the last instance of substr in string s, return a pair of the
initial string including substr and suffix from substr.
def
countSubmatches
(
substr :
{ substr = Regex }
s :
String
)
: Int32
\ Pure
Count the occurrences of substr in string s.
def
countSubmatchesWithBounds
(
substr :
{ substr = Regex }
start :
{ start = Int32 }
end :
{ end = Int32 }
s :
String
)
: Int32
\ Pure
Count the occurrences of substr in string s within the bounds (start, end).
Returns 0 if the bounds are invalid.
def
endsWith
(
suffix :
{ suffix = Regex }
s :
String
)
: Bool
\ Pure
Returns true if the string input ends the regular expression Regex suffix.
This will be slower than startsWith because there is no primitive Java function
to call, instead the matches of patt are iterated until the last one is found.
def
flags
(
rgx :
Regex
)
: Set[Flag]
\ Pure
Return the flags used to build the Regex rgx.
def
getFirst
(
substr :
{ substr = Regex }
s :
String
)
: Option[String]
\ Pure
Return the content of the first occurence of substr in s from the left.
If the Regex substr is not present in s return None.
def
getFirstWithBounds
(
substr :
{ substr = Regex }
start :
{ start = Int32 }
end :
{ end = Int32 }
s :
String
)
: Option[String]
\ Pure
Return the content of the first occurence of substr in s from the left within
the bounds (start, end).
If the Regex substr is not present in s or the bounds are invalid return None.
def
getFirstWithOffset
(
substr :
{ substr = Regex }
offset :
{ offset = Int32 }
s :
String
)
: Option[String]
\ Pure
This is getFirst with a start offset.
If the Regex substr is not present in s return None.
def
getLast
(
substr :
{ substr = Regex }
s :
String
)
: Option[String]
\ Pure
Return the content of the last occurence of substr in s from the left.
If the Regex substr is not present in s return None.
def
getLastWithBounds
(
substr :
{ substr = Regex }
start :
{ start = Int32 }
end :
{ end = Int32 }
s :
String
)
: Option[String]
\ Pure
Return the content of the last occurence of substr in s from the left within
the bounds (start, end).
If the Regex substr is not present in s or the bounds are invalid return None.
def
getLastWithOffset
(
substr :
{ substr = Regex }
offset :
{ offset = Int32 }
s :
String
)
: Option[String]
\ Pure
This is getLast with a start offset.
If the Regex substr is not present in s return None.
def
getPrefix
(
substr :
{ substr = Regex }
s :
String
)
: Option[String]
\ Pure
Returns Some(prefix) of string s if its prefix matches substr.
def
getSuffix
(
substr :
{ substr = Regex }
s :
String
)
: Option[String]
\ Pure
Returns Some(suffix) of string s if its suffix matches substr.
def
indexOfFirst
(
substr :
{ substr = Regex }
s :
String
)
: Option[Int32]
\ Pure
Return the index of the first occurence of substr in s from the left.
If the Regex substr is not present in s return None.
def
indexOfFirstWithBounds
(
substr :
{ substr = Regex }
start :
{ start = Int32 }
end :
{ end = Int32 }
s :
String
)
: Option[Int32]
\ Pure
Return the index of the first occurence of substr in s from the left within
the bounds (start, end).
If the Regex substr is not present in s or the bounds are invalid return None.
def
indexOfFirstWithOffset
(
substr :
{ substr = Regex }
offset :
{ offset = Int32 }
s :
String
)
: Option[Int32]
\ Pure
This is indexOfFirst with a start offset.
If the Regex substr is not present in s return None.
def
indexOfLast
(
substr :
{ substr = Regex }
s :
String
)
: Option[Int32]
\ Pure
Return the index of the last occurence of substr in s starting from the left.
If the Regex substr is not present in s return None.
def
indexOfLastWithBounds
(
substr :
{ substr = Regex }
start :
{ start = Int32 }
end :
{ end = Int32 }
s :
String
)
: Option[Int32]
\ Pure
Return the index of the last occurence of substr in s from the left within
the bounds (start, end).
If the Regex substr is not present in s or the bounds are invalid return None.
def
indexOfLastWithOffset
(
substr :
{ substr = Regex }
offset :
{ offset = Int32 }
s :
String
)
: Option[Int32]
\ Pure
This is indexOfLast with a start offset.
If the Regex substr is not present in s return None.
def
indices
(
substr :
{ substr = Regex }
s :
String
)
: List[Int32]
\ Pure
Returns the positions of the all the occurrences of substr in s.
If substr regexp matches the empty string, positions where an empty match
has been recognized will be returned.
def
indicesWithBounds
(
substr :
{ substr = Regex }
start :
{ start = Int32 }
end :
{ end = Int32 }
s :
String
)
: List[Int32]
\ Pure
Returns the positions of the all the occurrences of substr in s
within the bounds (start, end).
If substr regexp matches the empty string, positions where an empty match
has been recognized will be returned.
Returns Nil if there are no matches or the bounds are invalid.
def
isMatch
(
rgx :
Regex
s :
String
)
: Bool
\ Pure
Returns true if the entire string s is matched by the Regex rgx.
def
isMatchWithBounds
(
rgx :
Regex
start :
{ start = Int32 }
end :
{ end = Int32 }
s :
String
)
: Bool
\ Pure
Returns true if the entire string s is matched by the Regex rgx.
Returns false if the entire string does not match or the bounds are invalid.
def
isSubmatch
(
rgx :
Regex
s :
String
)
: Bool
\ Pure
Returns true if the string input is matched by the Regex rgx
at any position within the string s.
def
isSubmatchWithBounds
(
rgx :
Regex
start :
{ start = Int32 }
end :
{ end = Int32 }
s :
String
)
: Bool
\ Pure
Returns true if the string input is matched by the Regex rgx
at any position within the string s that is within the bounds (start, end).
Returns false if there is no match or the bounds are invalid.
def
pattern
(
rgx :
Regex
)
: String
\ Pure
Return the regular expression string used to build this Regex.
def
quote
(
s :
String
)
: String
\ Pure
Return the regular expression string that matches the the literal string s.
def
replace
(
from :
{ from = Regex }
to :
{ to = String }
s :
String
)
: String
\ Pure
Returns string s with every match of the Regex from replaced by the string to.
def
replaceFirst
(
from :
{ from = Regex }
to :
{ to = String }
s :
String
)
: String
\ Pure
Returns string s with the first match of the regular expression from replaced by the string to.
def
split
(
regex :
{ regex = Regex }
s :
String
)
: List[String]
\ Pure
Splits the string s around matches of the Regex regex.
def
startsWith
(
prefix :
{ prefix = Regex }
s :
String
)
: Bool
\ Pure
Returns true if the string s starts the Regex prefix.
def
stripPrefix
(
substr :
{ substr = Regex }
s :
String
)
: Option[String]
\ Pure
Returns Some(suffix) of string s if its prefix matches substr.
def
stripSuffix
(
substr :
{ substr = Regex }
s :
String
)
: Option[String]
\ Pure
Returns Some(prefix) of string s if its suffix matches substr.
def
submatches
(
substr :
{ substr = Regex }
s :
String
)
: List[String]
\ Pure
Returns the contents of the all the occurrences of substr in s.
Returns Nil if substr is the empty string.
def
submatchesWithBounds
(
substr :
{ substr = Regex }
start :
{ start = Int32 }
end :
{ end = Int32 }
s :
String
)
: List[String]
\ Pure
Returns the contents of the all the occurrences of substr in s
within the bounds (start, end).
Returns Nil if substr is the empty string or the bounds are invalid.
def
sumFlags
(
flags :
Set[Flag]
)
: Int32
\ Pure
Sum a list of flags to an Int32 bit mask.
def
unmatchable
: Regex
\ Pure
Return the unmatchable Regex - a regular expression that will not match any input.