Pattern
find
(λ [&Pattern, &String] Int)
finds the index of a pattern in a string.
Returns -1
if it doesn’t find a matching pattern.
find-all
(λ [&Pattern, &String] (Array Int))
finds all indices of a pattern in a string.
Returns []
if it doesn’t find a matching pattern.
from-chars
(λ [(Ref (Array Char))] Pattern)
(from-chars chars)
creates a pattern that matches a group of characters from a list of those characters.
global-match
(λ [&Pattern, &String] (Array (Array String)))
finds all matches of a pattern in a string as a nested array.
Returns []
if it doesn’t find a matching pattern.
match-groups
(λ [&Pattern, &String] (Array String))
finds the match groups of the first match of a pattern in a string.
Returns []
if it doesn’t find a matching pattern.
match-str
(λ [&Pattern, &String] String)
finds the first match of a pattern in a string.
Returns []
if it doesn’t find a matching pattern.
matches?
(λ [&Pattern, &String] Bool)
(matches? pat s)
checks whether a pattern matches a string.
substitute
(λ [&Pattern, &String, &String, Int] String)
finds all matches of a pattern in a string and replaces it by another pattern n
times.
If you want to replace all occurrences of the pattern, use -1
.