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 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 SAS Regular Expressions (RX) and Perl Regular Expressions (PRX)' on page 260.
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' on page 270.
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:
'CALL PRXCHANGE Routine' on page 354
'CALL PRXDEBUG Routine' on page 356
'CALL PRXFREE Routine' on page 358
'CALL PRXNEXT Routine' on page 359
'CALL PRXPOSN Routine' on page 361
'CALL PRXSUBSTR Routine' on page 364
'CALL PRXCHANGE Routine' on page 354
'PRXCHANGE Function' on page 739
'PRXMATCH Function' on page 743
'PRXPARSE Function' on page 748
'PRXPOSN Function' on page 750