Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

rexMatchp

rexMatchp( 
t_pattern 
S_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

t_pattern

Regular expression pattern.

S_target

String or symbol to be matched against the pattern.

Value Returned

t

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

String Functions

rexCompile

rexExecute


Return to top
 ⠀
X