Date: Mon, 5 Sep 2011 18:56:34 -0400
Reply-To: Arthur Tabachneck <art297@ROGERS.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@ROGERS.COM>
Subject: How to remove a regular expression
I've finally decided that I can no longer avoid regular expressions.
Given the following:
data have;
informat stuff $80.;
input stuff &;
cards;
Now is the time for all good men and women
to come to the GG5567AA aid of their party
Or, was it 4567890 or 45678901 that caused
the problems.
4567890
45678901
ABC4EFGH
;
How would one go about removing strings contained within the strings shown
above that are exactly eight characters in length, contain only letters
and/or numbers, but contain at least one number?
I think that the necessary expression is shown in the datastep I've started
below, but I have no idea how to complete the task.
data want;
set have;
if _N_ = 1 then do;
re = prxparse("^(?=[a-zA-z0-9]*\d).{8,8}$");
end;
Thanks in advance,
Art
|