mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
32c1b5f4d1
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@568 0fc631ac-6414-0410-93d0-97cfa31319b6
27 lines
788 B
Plaintext
27 lines
788 B
Plaintext
Function: match
|
|
|
|
--Usage--
|
|
> match(some_string, match: regular expression)
|
|
> match_rule(regular expression)()
|
|
|
|
Does a string match the given [[type:regex|regular expression]]?
|
|
|
|
This function is available in [[script:rule form]].
|
|
When the match is performed many times the rule form is more efficient, because the regular expression is only compiled once.
|
|
|
|
--Parameters--
|
|
| @input@ [[type:string]] String to match.
|
|
| @match@ [[type:regex]] Regular expression to match.
|
|
|
|
--Examples--
|
|
> match("aaaa", match:"a*") == true
|
|
> match("a", match:"b*") == true
|
|
> match("abc", match:"b+") == true
|
|
> match("abc", match:"$b+^") == false
|
|
>
|
|
> f := match_rule(match: "a+|b+")
|
|
> f("xyz") == false
|
|
|
|
--See also--
|
|
| [[fun:contains]] Does a string contain another one?
|