Forum Moderators: coopster & phranque

Message Too Old, No Replies

printing out regular expression question

         

sammy

8:43 pm on Sep 27, 2001 (gmt 0)



Hi, sorry, i know this is a really really simple question but i was wondering if it was possible to print out the match to the regular expression in perlscript (using asp as the interpreter)...
ie...here's my example...
i wanted to find the dir path (ie, C:\inetpub\wwroot\) that a file was using and match only the path name...
so i did this:

$Filename = (path.asp);
$path = $Server->MapPath($Filename);
$newpath = $path =~ /path.asp\b/;
$Response->Write($newpath);

which returns 1 as true...since it finds that match....but i want it to return the actual name of the path that it found without the filename....can someone tell me how to do that?

sugarkane

9:23 pm on Sep 27, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi sammy, welcome to wmw

I've no experience in the perlscript / asp combination, but in Perl the easiest way would probably be to just chop off the filename from $path:

$path=~s/$filename//;

Then use $Response->Write($path);

Hopefully this will work, let us know...

sammy

11:00 pm on Sep 27, 2001 (gmt 0)



wow! thanx a lot....that's actually what i was trying....
:) sam