Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: regex with arrays and variables

by NetWallah (Abbot)
on Apr 25, 2013 at 18:20 UTC ( #1030714=note: print w/ replies, xml ) Need Help??

in reply to regex with arrays and variables

Your regex concat command creates a regex that looks like:

That trailing "|" allows an empty match.

This is why all elements matched.

Try removing the trailing "|". This is the canonical way to match a bunch of different things. Also, you do not need the parens, unless you are capturing.

Lastly, use a "join" instead of looping and concatenating - that will also avoid the trailing "|".

             "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
        -- Dr. Cox, Scrubs

Comment on Re: regex with arrays and variables
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2015-11-27 08:33 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (722 votes), past polls