matches: Difference between revisions
Jump to navigation
Jump to search
m (Added MacroFunction template and String Function category) |
Verisimilar (talk | contribs) m (Added version.) |
||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name=matches | |name=matches | ||
|version=1.3b48 | |||
|description= | |description= | ||
Returns 1 if a string matches pattern or 0 if it does not. The pattern can be a [[Macros:regular expression|regular expression]]. Matches performs a while string comparison, so the pattern must match the whole of the input string and not only part of it. | Returns 1 if a string matches pattern or 0 if it does not. The pattern can be a [[Macros:regular expression|regular expression]]. Matches performs a while string comparison, so the pattern must match the whole of the input string and not only part of it. | ||
Line 6: | Line 7: | ||
|usage= | |usage= | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
matches(str, pattern) | |||
</source> | </source> | ||
Revision as of 11:46, 10 March 2009
matches() Function
• Introduced in version 1.3b48
Returns 1 if a string matches pattern or 0 if it does not. The pattern can be a regular expression. Matches performs a while string comparison, so the pattern must match the whole of the input string and not only part of it.
Usage
matches(str, pattern)
Examples
[r: matches("This is a test", "test")]
[r: matches("test", "test")]
[r: matches("This is a test", ".*test")]
Returns
0 11