regmatch(<string>, <pattern>, <register>)
This function performs regular expression matching with
, returning 1 if there is a match or 0 if no match exists. The
may contain wildcards
, but it must not begin with any
boolean characters. The
is not case-sensitive.
This function has the side-effect of modifying the environment variables
with the text substituted by each wildcard in
. That is,
the text matching the first
, the second becomes
so on up through
. Wildcards beyond
are not recorded but still determine
whether a successful match takes place.
number from 0 to 9 can be specified. This determines
the first environment variable to which the parser will begin recording
If only the side-effect of the function is wanted, you can use
to nullify the result.
| say Match=[regmatch(@set me=Dark,@set =)], env0=%0, env1=%1
|| You say, "Match=1, env0=me, env1=Dark"
| say Match=[regmatch(Does not match,*k*)], env0=%0, env1=%1
|| You say, "Match=0, env0=, env1="
| say [left(regmatch(abc def,* *,2),0)]env0=%0, env1=%1, env2=%2, env3=%3
|| You say, "env0=, env1=, env2=abc, env3=def"
See also: match()
#-1 Invalid global register. - The
<register> was not in the range 0 to 9.
From the TinyMARE Help command - Courtesy Gandalf
- 03 Nov 2006