Types

RegExp

Methods

-(s:Str, r:RegExp)
Returns the string with one occurrence of regexp cut out of it. Throws InvalidArgument if s does not contain r.
.(regexp:RegExp, attr:Str)
Get attributes of a RegExp. Throws AttrNotFound if attr is not one of the allowed values. You should not use this directly. Use "~" and "~~" operators.
[](s:Str, r:RegExp)
Get substring of a string that corresponds to first match of given regular expression %EX "x10ab20c30y"[/[0-9]+/] # "10"
c_pcre_exec(regexp:RegExp, subject:Str, offset:Int, options:Int)
Search string for regular expression. Uses PCRE_EXEC(3). Do not use this function directly!
Pred(r:RegExp)
Convert regular expression to a predicate.
replace(s:Str, r:RegExp, mapper:Fun)
Replace all occurrences of r
split(s:Str, r:RegExp)
%EX "x10ab20c30y".split(/[0-9]+/).join(" :: ") # "x :: ab :: c :: y"
Str(regexp:RegExp)
Represents RegExp
without(s:Str, r:RegExp)
Get string with all occurrences of r removed
~(s:Str, r:RegExp, offset:Int=0, options:Int=0)
Find PCRE regular expression in s. Empty string without options returns MatchN. Throws Error if more than 20 captures are used or if there is an error during matching.
~~(s:Str, r:RegExp, collect_unmatched:Bool=false)
Find all non-overlapping matches of regular expression in a string.