Enables Perl regular expressions in a DATA step to send debugging output to the SAS log.
Category: | Character String Matching |
Restriction: | Use with the CALL PRXCHANGE, CALL PRXFREE, CALL PRXNEXT, CALL PRXPOSN, CALL PRXSUBSTR, PRXPARSE, PRXPAREN, and PRXMATCH functions and CALL routines. The PRXPARSE function is not DBCS compatible. |
data _null_; /* Turn the debugging option on. */ call prxdebug(1); putlog 'PRXPARSE: '; re = prxparse('/[bc]d(ef*g)+h[ij]k$/'); putlog 'PRXMATCH: '; pos = prxmatch(re, 'abcdefg_gh_'); /* Turn the debugging option off. */ call prxdebug(0); run;
PRXPARSE: Compiling REx '[bc]d(ef*g)+h[ij]k$' 1 size 41 first at 1 2 rarest char g at 0 5 rarest char d at 0 1: ANYOF[bc](10) 3 10: EXACT <d>(12) 12: CURLYX[0] {1,32767}(26) 14: OPEN1(16) 16: EXACT <e>(18) 18: STAR(21) 19: EXACT <f>(0) 21: EXACT <g>(23) 23: CLOSE1(25) 25: WHILEM[1/1](0) 26: NOTHING(27) 27: EXACT <h>(29) 29: ANYOF[ij](38) 38: EXACT <k>(40) 40: EOL(41) 41: END(0) anchored 'de' at 1 floating 'gh' at 3..2147483647 (checking floating) 4 stclass 'ANYOF[bc]' minlen 7 6 PRXMATCH: Guessing start of match, REx '[bc]d(ef*g)+h[ij]k$' against 'abcdefg_gh_'... Did not find floating substr 'gh'... Match rejected by optimizer
1 | This line shows the precompiled form of the Perl regular expression. |
2 | Size specifies a value in arbitrary units of the compiled form of the Perl regular expression. 41 is the label ID of the first node that performs a match. |
3 | This line begins a list of program nodes in compiled form for regular expressions. |
4 | These two lines provide optimizer information. In the example above,
the optimizer found that the match should contain the substring de at offset 1, and the substring gh at an offset between 3 and infinity. To rule out a pattern match
quickly, Perl checks substring gh before
it checks substring de .
The optimizer might
use the information that the match begins at the first ID (line 2), with a character class (line
5), and cannot be shorter than seven characters (line 6).
|