Page 1 of 1

Using @replace with wildcard

Posted: Fri Jun 03, 2011 9:56 am
by lisacabisa
Is it possible to use @replace string function with a wildcard? If not, does anyone have an idea how to do what I'm trying to do?

I am trying to strip off the path information so I have just the Eviews workfile name.

%wfpath = "C:\work\Eviews\q2fy10_sys.wf1"
%wf = @replace(%wfpath,"*\","")

I would expect replacement to remove all characters up to and including the last backslash so that %wf is equal to q2fy10_sys.wf1

Does not seem to work...

TIA

Re: Using @replace with wildcard

Posted: Fri Jun 03, 2011 10:10 am
by EViews Gareth
No, it doesn't work that way (nor could it, logically).

If you know that your path has 3 slashes in it, then you can use @instr and @mid to do what you want:

Code: Select all

%wfpath = "C:\work\Eviews\q2fy10_sys.wf1" %wf = @mid(%wfpath, @instr(%wfpath, "\", 3)+1)

Re: Using @replace with wildcard

Posted: Sat Jul 02, 2011 2:12 am
by monjoride
and if the path is longer than 3 slashes?

Action Plan Of GSM Repeater
GSM Repeater 900Mhz

Re: Using @replace with wildcard

Posted: Sat Jul 02, 2011 11:40 am
by EViews Gareth

Code: Select all

%wfpath = "C:\work\Eviews\q2fy10_sys.wf1" %wf = %wfpath !pos = @instr(%wf, "\") while !pos>0 %wf = @mid(%wf, !pos+1) !pos = @instr(%wf, "\") wend
Or something along those lines.

Re: Using @replace with wildcard

Posted: Fri Apr 27, 2012 5:20 am
by Gardner
Hey...
Nice link shared...
Its a great site for getting the information...
Thank you for sharing this great informative stuff here...
_______________
basement dehumidifier