Regex

Type Aliases

type alias MatchQuery[a: Type, r: Eff] = Matcher[r] -> Result[String, a] \ r Source

MatchQuery is a read query applied to a the current match of a Matcher.

Definitions

def breakAfterFirst(substr: { substr = Regex }, s: String): (String, String) Source

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) Source

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) Source

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) Source

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 Source

Count the occurrences of substr in string s.

def countSubmatchesWithBounds(substr: { substr = Regex }, start: { start = Int32 }, end: { end = Int32 }, s: String): Int32 Source

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 Source

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] Source

Return the flags used to build the Regex rgx.

def getFirst(substr: { substr = Regex }, s: String): Option[String] Source

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] Source

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] Source

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] Source

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] Source

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] Source

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] Source

Returns Some(prefix) of string s if its prefix matches substr.

def getSuffix(substr: { substr = Regex }, s: String): Option[String] Source

Returns Some(suffix) of string s if its suffix matches substr.

def indexOfFirst(substr: { substr = Regex }, s: String): Option[Int32] Source

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] Source

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] Source

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] Source

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] Source

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] Source

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] Source

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] Source

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 Source

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 Source

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 Source

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 Source

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 Source

Return the regular expression string used to build this Regex.

def quote(s: String): String Source

Return the regular expression string that matches the the literal string s.

def replace(src: { src = Regex }, dst: { dst = String }, s: String): String Source

Returns string s with every match of the Regex src replaced by the string dst.

def replaceFirst(src: { src = Regex }, dst: { dst = String }, s: String): String Source

Returns string s with the first match of the regular expression src replaced by the string dst.

def split(regex: { regex = Regex }, s: String): List[String] Source

Splits the string s around matches of the Regex regex.

def startsWith(prefix: { prefix = Regex }, s: String): Bool Source

Returns true if the string s starts the Regex prefix.

def stripPrefix(substr: { substr = Regex }, s: String): Option[String] Source

Returns Some(suffix) of string s if its prefix matches substr.

def stripSuffix(substr: { substr = Regex }, s: String): Option[String] Source

Returns Some(prefix) of string s if its suffix matches substr.

def submatches(substr: { substr = Regex }, s: String): List[String] Source

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] Source

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 Source

Sum a list of flags to an Int32 bit mask.

def unmatchable(): Regex Source

Return the unmatchable Regex - a regular expression that will not match any input.