${re op arg... }
10 \f5${re g regexp [ arg...]\f5} Yields a list of each arg that matches regexp .
\f5${re v regexp [ arg...]\f5} Yields a list of each arg that does not match regexp .
\f5${re m regexp arg\f5} Yields the portion of arg that matches regexp , or an empty list if there was no match.
\f5${re M regexp arg\f5} Yields a list consisting of the portion of arg that matches regexp , followed by list elements giving the portion of arg that matched each parenthesized subexpression in turn.
\f5${re mg regexp arg\f5} Similar to re m except that it applies the match consecutively through arg , yielding a list of all the portions of arg that match regexp . If a match is made to the null string, no subsequent substitutions will take place.
\f5${re s regexp subs [ arg... ]\f5} For each arg , re s substitutes the first occurrence of regexp (if any) by subs . If subs contains a sequence of the form \e d where d is a single decimal digit, the d th parenthesised subexpression in regexp will be substituted in its place. \e0 is substituted by the entire match. If any other character follows a backslash ( \e ), that character will be substituted. Arguments which contain no match to regexp will be left unchanged.
\f5${re sg regexp subs [ arg... ]\f5} Similar to re s except that all matches of regexp within each arg will be substituted for, rather than just the first match. Only one occurrence of the null string is substituted.
Break string up into its constituent characters, putting the result in shell variable x : .EX x = ${re mg '.|\en' string}
Quote a string s so that it can be used as a literal regular expression without worrying about metacharacters: .EX s = ${re sg '[*|[\e\e+.^$()?]' '\e\e\e0' $s}
Define a substitution function pat2regexp to convert shell-style patterns into equivalent regular expressions (e.g. `` ?.sbl* '' would become `` ^.\e.sbl.*$ ''): .EX load std subfn pat2regexp { result = '^' ^ ${re sg '\e*' '.*' ${re sg '\?' '.' ${re sg '[()+\e\e.^$|]' '\e\e\e0' $*} } } ^ '$' }