pcreExecute
pcreExecute(o_comPatObjS_subject[x_options] ) =>t/nil
Description
Matches the subject string or symbol (S_subject) against a previously compiled pattern set up by the last pcreCompile call (o_comPatObj). The matching algorithm is PCRE/Perl-compatible. You can use a third (optional) argument to specify independent option bits for controlling pattern matching. You can use this function in conjunction with pcreCompile to match several subject strings or symbols against a single pattern.
Arguments
|
Data object containing the compiled pattern returned from a previous pcreCompile call. |
|
|
Subject string or symbol to be matched. If it is a symbol, its print name is used. |
|
|
(Optional) Independent option bits that affect pattern matching. You can specify zero or more of these options symbolically using the pcreGenExecOptBits SKILL function. |
Valid Values:
|
Equivalent to setting |
|
|
Equivalent to setting |
|
|
Equivalent to setting |
|
|
Equivalent to setting |
|
|
Equivalent to setting |
Value Returned
|
No match. You can see the error message associated with this matching failure by calling pcrePrintLastMatchErr. |
Examples
comPat1 = pcreCompile( "[12[:^digit:]]" )
=> pcreobj@0x27d150 pcreExecute( comPat1 "abc" )
=> t
comPat2 = pcreCompile( "((?i)ab)c" )
=> pcreobj@0x27d15c
pcreExecute( comPat2 "aBc" )
=> t
comPat3 = pcreCompile( "\\d{3}" )
=> pcreobj@0x27d168
pcreExecute( comPat3 "789" )
=> t
comPat4 = pcreCompile( "(\\D+|<\\d+>)*[!?]" )
=> pcreobj@0x27d174
pcreExecute( comPat4 "Hello World!" )
=> t
comPat5 = pcreCompile( "^\\d?\\d(jan|feb|mar|apr|may|jun)\\d\\d$/" )
=> pcreobj@0x27d180
pcreExecute( comPat5 "25jun3" ) => nil
pcreExecute( comPat5 "25jun3" pcreGenExecOptBits(?anchored t) )
=> nil
pcreExecute( comPat5 "25jun3" pcreGenExecOptBits(?partial t) )
=> t
Related Topics
Return to top