Pattern

=

external

(λ [&Pattern, &Pattern] Bool)

copy

external

(λ [&Pattern] Pattern)

find

external

(λ [&Pattern, &String] Int)

finds the index of a pattern in a string.

Returns -1 if it doesn’t find a matching pattern.

find-all

external

(λ [&Pattern, &String] (Array Int))

finds all indices of a pattern in a string.

Returns [] if it doesn’t find a matching pattern.

from-chars

defn

(λ [(Ref (Array Char))] Pattern)

                    (from-chars chars)
                

creates a pattern that matches a group of characters from a list of those characters.

global-match

external

(λ [&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.

init

external

(λ [&String] Pattern)

match-groups

external

(λ [&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

external

(λ [&Pattern, &String] String)

finds the first match of a pattern in a string.

Returns [] if it doesn’t find a matching pattern.

matches?

defn

(λ [&Pattern, &String] Bool)

                    (matches? pat s)
                

checks whether a pattern matches a string.

prn

external

(λ [&Pattern] String)

str

external

(λ [&Pattern] String)

substitute

external

(λ [&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.