rexMatchp
rexMatchp(t_patternS_target) =>t/nil
Description
Checks to see if a string or symbol matches a given regular expression pattern. The supplied regular expression pattern overwrites the previously compiled pattern and is used for subsequent matching until the next new pattern is provided.
This function matches S_target against the regular expression t_pattern and returns t if a match is found, nil otherwise. An error is signaled if the given pattern is ill-formed. For greater efficiency when matching a number of targets against a single pattern, use the rexCompile and rexExecute functions.
Arguments
Value Returned
|
A match is found. Signals an error if the given pattern is ill-formed. |
Examples
rexMatchp("[0-9]*[.][0-9][0-9]*" "100.001")
=> t
rexMatchp("[0-9]*[.][0-9]+" ".001")
=> t
rexMatchp("[0-9]*[.][0-9]+" ".")
=> nil
rexMatchp("[0-9]*[.][0-9][0-9]*" "10."
=> nil
rexMatchp("[0-9" "100")
*Error* rexMatchp: Missing ] - "[0-9"
Related Topics
Return to top