pcreMatchp
pcreMatchp(g_patternS_subject[x_compOptBits] [x_execOptBits] ) =>t/nil
Description
Checks to see whether the subject string or symbol (S_subject) matches the specified regular expression pattern (g_pattern). You can use optional arguments to specify independent option bits for controlling pattern compiling and matching. The compiling and matching algorithms are PCRE/Perl-compatible. For greater efficiency when matching a number of subjects against a single pattern, you should use pcreCompile and pcreExecute.
The specified regular expression pattern overwrites the previously-compiled pattern and is used for subsequent matching until you provide a new pattern. The function reports any errors in the given pattern.
You can set and unset the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and PCRE_EXTENDED independent option bits from within the pattern. The content of the options argument specifies the initial setting at the start of compilation. You can set the PCRE_ANCHORED option at matching time and at compile time.
pcreObject is specified as the g_pattern, pcreMatchp skips pattern compilation and ignores x_compOptBits.Arguments
|
String containing regular expression string to be compiled or a |
|
|
Subject string or symbol to be matched. If it is a symbol, its print name is used. |
|
|
(Optional) Independent option bits that affect the compilation. Valid values for this argument are the same as those for the x_options argument to the pcreCompile SKILL function. |
|
|
(Optional) Independent option bits that affect pattern matching. Valid values for this argument are the same as those for the x_options argument to the pcreExecute SKILL function. |
Value Returned
|
A message appears if you have any errors in the regular expression pattern. |
|
|
An error message indicating the cause of the matching failure appears. |
Examples
pcreMatchp( "[0-9]*[.][0-9][0-9]*" "100.001" )
=> t
pcreMatchp( "[0-9]*[.][0-9]+" ".001" )
=> t
pcreMatchp( "[0-9]*[.][0-9]+" "." )
=> nil
pcreMatchp( "[0-9" "100" )
=>
*Error* pcreCompile: compilation failed at offset 4: missing terminating ] for character class nil
pcreMatchp( "((?i)rah)\\s+\\1" "rah rah" )
=> t
pcreMatchp( "^[0-9]+" "abc\n123\nefg"
pcreGenCompileOptBits(?multiLine t) pcreGenExecOptBits( ?notbol t) )
=> t
Related Topics
Return to top