pcreMatchList
pcreMatchList(g_patternl_subjects[x_compOptBits] [x_execOptBits] ) =>l_results/nil/ error message(s)
Description
Matches a list of subjects (strings or symbols) against a regular expression pattern (g_pattern) and returns a list of those elements that match. 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.
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, pcreMatchList skips pattern compilation and ignores x_compOptBits.Arguments
|
String containing regular expression string to be compiled or a |
|
|
List of subject strings or symbols to be matched against the regular expression string. 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
Examples
pcreMatchList( "^[a-z][0-9]*" '(a01 x02 "003" aa01 "abc") )
=> (a01 x02 aa01 "abc")
pcreMatchList( "^[a-z][0-9][0-9]*" '(a001 b002 "003" aa01 "abc") )
=> (a001 b002)
pcreMatchList( "box[0-9]*" '(square circle "cell9" "123") )
=> nil
pcreMatchList("^[a-z][0-9][0-9]*" '("12\na001" b002)
pcreGenCompileOptBits(?multiLine t) pcreGenExecOptBits( ?notbol t) )
=> ("12\na001")
pcreMatchList("^[a-z][0-9]*" '(abc 123))
=>
*Error* pcreMatchList: element in the list given as argument #2 must be either a symbol or a string - 123
pcreMatchList( "^[a-z][0-9]*$" '((abc "ascii") (a123 "alphanum")) )
=>
*Error* pcreMatchList: element in the list given as argument #2 must be either a symbol or a string - (abc "ascii")
Related Topics
Return to top