Matching operations with regular expressions (original) (raw)

Testing if a string matches a regular expression:
matches? ( string regexp -- ? )

Finding a match inside a string:

re-contains? ( string regexp -- ? )

first-match ( string regexp -- slice/f )

Finding all matches inside a string:

count-matches ( string regexp -- n )

all-matching-slices ( string regexp -- seq )
all-matching-subseqs ( string regexp -- seq )

Splitting a string into tokens delimited by a regular expression:

re-split ( string regexp -- seq )

Replacing occurrences of a regular expression with a string:

re-replace ( string regexp replacement -- result )

re-replace-with ( string regexp quot: ( slice -- replacement ) -- result )