Functions and CALL Routines |
Returns the last bracket match for which there is a match in a
pattern.
Category: |
Character String Matching
|
Restriction: |
Use with the PRXPARSE function.
|
PRXPAREN
(regular-expression-id)
|
-
regular-expression-id
-
specifies a numeric variable with a value
that is an identification number that is returned by the PRXPARSE function.
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.
For more information about pattern matching, see
Pattern Matching Using Perl Regular Expressions (PRX).
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 Functions and CALL Routines by Category.
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
|
Functions and CALL routines:
|
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.