f



Regex

Hi friends,

I have a little question about a test that I want to build with a regular
expression.

*** Subject 1 : My users send me a dynamic list of parameters. One of this
parameter is Filename= with the name of a file and I want to catch the name
of the file and save it on a variable named TARGET.

I wrote a Prxchange call but it works (more or less) only if I have one
parameter.

data cc;
length c $ 60 Target $ 60;
input c $60.;
prxNum=prxParse('s/(filename+)=[ ]*([a-zA-Z]*).(txt)[ ]/$2/');

CALL prxChange (prxNum,1,c,Target ,newLength,wasTruncated,numberChanges);
datalines;
 filename=Premier.txt
filename=John.txt
filename= BaaBaa.txt
hello
;

=> But what is the syntax if I have something before and / or after ?:


data cc;
length c $ 60 Target $ 60;
input c $60.;

prxNum=prxParse('s/(filename+)=[ ]*([a-zA-Z]*).(txt)[ ]/$2/');

CALL prxChange (prxNum,1,c,Target ,newLength,wasTruncated,numberChanges);
datalines;
 filename=Premier.txt, path=toto
a=1,  b=2 , path=toto, filename=John.txt
a=1,b=2,filename= BaaBaa.txt
Prince
;


***Subject 2 : Now I want to analyze mystring named C and if I find the
parameter PATH=xxxx I want to delete it. I save the string in TARGET2. Is it
possible to do that ?

Thanks :-/

Stephane.
0
scolas (213)
8/2/2008 11:31:46 AM
comp.soft-sys.sas 142827 articles. 4 followers. Post Follow

0 Replies
4287 Views

Similar Articles

[PageSpeed] 1

Reply: