matches

From RPTools Wiki
Revision as of 11:29, 13 December 2008 by Craig (talk | contribs) (New page: ==Function matches== Returns 1 if a string matches pattern or 0 if it does not. The pattern can be a Macros:regular expression. Matches performs a while string comparison, so the patt...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function matches

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

[h: val = matches(str, pattern)]


Examples

    [r: matches("This is a test", "test")]
    [r: matches("test", "test")]
    [r: matches("This is a test", ".*test")]

Returns

   0
   1
   1