Tigflanker 发表于 2014-3-24 12:42 
/* [^_] match an any symbol except an underscore "_" */
data _null_;
明白你要做什么了,感觉不太可能把这两件事情放在一个 prx-pattern.
Not sure whether the following is the same as your case. But you have many ways to do it with two patterns.
data _null_;
if _n_ = 1 then do;
pn1="/[[:punct:]]/"; p1 = prxparse(pn1);
pn2="/[_]/"; p2=prxparse(pn2);
retain p1 p2;
end;
input string $10.;
position1 = prxmatch(p1, string);
position2 = prxmatch(p2, string);
if position1 = position2 then
put _n_= "the first punctuation is found to be an _ at position: " position1 " in string: " string;
if position1 ^= position2 then
put _n_= "the first punctuation is found not to be an _ at position: " position1 " in string: " string;
datalines;
1234__&*=_
1234*:'_?_
^~!',:"??_
_~!',:"??_
; run;