Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: replacing text file separators in regex

by perlkid (Novice)
on Jul 06, 2002 at 04:31 UTC ( #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? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2022-06-30 18:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (98 votes). Check out past polls.

    Notices?