Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Simple regrep question

by Corion (Patriarch)
on Jun 26, 2016 at 07:46 UTC ( [id://1166577]=note: print w/replies, xml ) Need Help??


in reply to Simple regrep question

Maybe just look at HTML::LinkExtor?

Depending on how your URLs are structured, maybe the following will also suffice:

m!\b(http://.*?\.mp3)\b!

But that would also capture sequences of URLs like

http://example.com/ this is some text about my .mp3 files.

Replies are listed 'Best First'.
Re^2: Simple regrep question
by Athanasius (Archbishop) on Jun 26, 2016 at 08:27 UTC

    Easily fixed by excluding whitespace:

    #! perl use strict; use warnings; for ('Look here: http://example1.com/cool.mp3 for a great listen!', 'http://example.com/ this is some text about my .mp3 files.') { print "Match: $1\n" if m!\b(http://\S*?\.mp3)\b!; }

    Output:

    18:26 >perl 1664_SoPW.pl Match: http://example1.com/cool.mp3 18:26 >

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

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

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

    No recent polls found