No matching definitions.

tur/re-string

stdlib/re-string.tur

owned String siblings for the tur/re string builders.

Since: v2 (string-adoption-stdlib-plan, batch 3)

defn

re/replace-string

(re/replace-string [re : Regex input : cstr replacement : cstr] :)

replace the first match with a literal, as an owned

recompiled Regex from re/compile
inputinput string cstr
replacementliteral replacement cstr (no backreferences)

An owned String with the first match replaced (a copy of the input if there is no match).

(string/to-cstr (re/replace-string (re/compile "[0-9]") "a1b2" "X"))
  ; => "aXb2"

Since: v2

defn

re/replace-all-string

(re/replace-all-string [re : Regex input : cstr replacement : cstr] :)

replace all non-overlapping matches with a literal,

recompiled Regex from re/compile
inputinput string cstr
replacementliteral replacement cstr (no backreferences)

An owned String with every match replaced.

(string/to-cstr (re/replace-all-string (re/compile "[0-9]") "a1b2c3" "X"))
  ; => "aXbXcX"

Since: v2

defn

re/union-patterns-string

(re/union-patterns-string [patterns : int] :)

build an alternation regex from a cons list of

patterns:int cons list of cstr patterns (head = cstr pointer)

An owned String of the unioned pattern, or an empty String if the list is empty or contains a null element.

(string/to-cstr (re/union-patterns-string (cons "[A-Za-z]+" (cons "[0-9]+" 0))))
  ; => "([A-Za-z]+)|([0-9]+)"

Since: v2