Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Conditional Regex

by Sidhekin (Priest)
on Nov 27, 2006 at 06:41 UTC ( [id://586190]=note: print w/replies, xml ) Need Help??


in reply to Conditional Regex

If I read you right, you want to test that the string starts with either a "/" or "http://localhost.net" (with variations). On that assumption, an alternation (plus some variation) should do it (/x whitespace added for clarity):

m,^(?: / | http:// [^/]* \b localhost\.net ),x

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-24 01:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found