Take a look at CALL PRXNEXT Routine
Using the example code and adjusting the Regular Expression
data _null_;
ExpressionID = prxparse('/failed.*?\./');
text = 'The woods have a failed here for some reason. bat, cat, and failed here with some other text. a rat!';
start = 1;
stop = length(text);
/* Use PRXNEXT to find the first instance of the pattern, */
/* then use DO WHILE to find all further instances. */
/* PRXNEXT changes the start parameter so that searching */
/* begins again after the last match. */
call prxnext(ExpressionID, start, stop, text, position, length);
do while (position > 0);
found = substr(text, position, length);
put found= position= length=;
call prxnext(ExpressionID, start, stop, text, position, length);
end;
run;
... View more