Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: replacing text file separators in regex

by perlkid (Novice)
on Jul 06, 2002 at 04:31 UTC ( [id://179796]=note: print w/replies, xml ) Need Help??


in reply to replacing text file separators in regex

I would think, the following RE works with your case.

#Given that a comma separator is used between site and path
#$2 may or may not contain / or @ 

$url=~ /^(\w+):\/\/(.*),(.*)$/ ;


I assumed that your data looks like one of the following cases

ftp://XX/yyy:password@123.123.123.123,/
ftp://site,path
ftp://site,

For the "uninitailized value" warning use the defined fcn,

for example:
if (defined($site =~ /\@/)) { .. } else { .. }

-perlkid
  • Comment on Re: replacing text file separators in regex

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://179796]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found