Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Complicated regexp problem (Updated)

by AnomalousMonk (Archbishop)
on Aug 02, 2017 at 22:38 UTC ( [id://1196597]=note: print w/replies, xml ) Need Help??


in reply to Complicated regexp problem

This is a variation on stevieb's reply. The optional  ftp:// doesn't make much sense unless it's anchored to something; I anchor it with  \A absolute-start-of-string. (Update: By the same token, the  (?: [^/]+ /){5} five-level-deep directory nesting pattern only makes sense if you specify five levels deep from what. Again,  \A is used, but I don't know if this is appropriate to stefanches7 true requirement.)

c:\@Work\Perl\monks>perl -wMstrict -le "my $regexp = qr{ \A (?: ftp://)? (?: [^/]+ /){5} ([a-z_]+) / }xms; ;; my $link = 'ftp://ftp.ensemblgenomes.org/pub/release-36/metazoa/vcf/ixodes_sca +pularis/ixodes_lapuscaris_incl_consequences.vcf.gz'; ;; print qq{captured '$1'} if $link =~ $regexp; " captured 'ixodes_scapularis'


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-03-28 18:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found