Regex¶
A perl compatible regular expression. This uses the PCRE2 library, and attempts to enable JIT matching whenever possible.
Constructors¶
create¶
Compile a regular expression. Raises an error for an invalid expression.
Parameters¶
Returns¶
- Regex ref^ ?
Public Functions¶
matches¶
Creates a match iterator from the regular expression that will iterate over the supplied subject returning matches.
Parameters¶
- subject: String val
Returns¶
- MatchIterator ref
eq¶
Return true on a successful match, false otherwise.
Parameters¶
Returns¶
- Bool val
ne¶
Return false on a successful match, true otherwise.
Parameters¶
Returns¶
- Bool val
apply¶
Match the supplied string, starting at the given offset. Returns a Match object that can give precise match details. Raises an error if there is no match.
Parameters¶
Returns¶
- Match ref^ ?
replace[optional A: (Seq[U8 val] iso & (String iso | Array[U8 val] iso))]¶
Perform a match on the subject, starting at the given offset, and create a new string using the value as a replacement for what was matched. Raise an error if there is no match.
fun box replace[optional A: (Seq[U8 val] iso & (String iso | Array[U8 val] iso))](
subject: (String val | Array[U8 val] val),
value: (String box | Array[U8 val] box),
offset: USize val = 0,
global: Bool val = false)
: A^ ?
Parameters¶
- subject: (String val | Array[U8 val] val)
- value: (String box | Array[U8 val] box)
- offset: USize val = 0
- global: Bool val = false
Returns¶
- A^ ?
split¶
Split subject by non-empty occurrences of this pattern, returning a list of the substrings.
Parameters¶
Returns¶
index¶
Returns the index of a named capture. Raises an error if the named capture does not exist.
Parameters¶
- name: String box
Returns¶
- USize val ?
dispose¶
Free the underlying PCRE2 data.
Returns¶
- None val