develooper Front page | perl.beginners | Postings from January 2002

Regex help Please...

Thread Next
From:
RArul
Date:
January 31, 2002 12:10
Subject:
Regex help Please...
Message ID:
78B385FB8F70D511857900B0D0D06A5874A7AF@mail.newenergyassoc.com
I know this is not a good RegEx. Can I see some criticism and fine-tuning of
this RegEx that I came up with? 

Objective: To parse the path to drive, directory and file name.

Here is what I came up with.

#################################
$fullpath = "C:/TopDir/outer/inner/file.fl";
($drive, $path, $file) =  ($fullpath =~ /(\w?):\/((?:\w+\/)*)(\w+\.\w+)$/);
print("$drive\n $path\n $file");
###################################


TIA,
Rex



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About