PRXPAREN Function
Returns the last bracket match for which there is
a match in a pattern.
Category: |
Character String Matching |
Restriction: |
Use with the PRXPARSE function. |
Syntax
Required Argument
regular-expression-id
specifies a numeric
variable with a value that is an identification number that is returned
by the PRXPARSE function.
Details
The PRXPAREN function
is useful in finding the largest capture-buffer number that can be
passed to the CALL PRXPOSN routine, or in identifying which part of
a pattern matched.
Comparisons
The Perl regular expression
(PRX) functions and CALL routines work together to manipulate strings
that match patterns. To see a list and short description of these
functions and CALL routines, see the Character String Matching category
in
SAS Functions and CALL Routines by Category.
Example
The following example
uses Perl regular expressions and writes the results to the SAS log.
data _null_;
ExpressionID = prxparse('/(magazine)|(book)|(newspaper)/');
position = prxmatch(ExpressionID, 'find book here');
if position then paren = prxparen(ExpressionID);
put 'Matched paren ' paren;
position = prxmatch(ExpressionID, 'find magazine here');
if position then paren = prxparen(ExpressionID);
put 'Matched paren ' paren;
position = prxmatch(ExpressionID, 'find newspaper here');
if position then paren = prxparen(ExpressionID);
put 'Matched paren ' paren;
run;
The following lines
are written to the SAS log:
Matched paren 2
Matched paren 1
Matched paren 3