Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: regex to find vowels in anyorder

by JavaFan (Canon)
on Dec 19, 2011 at 18:06 UTC ( [id://944289]=note: print w/replies, xml ) Need Help??


in reply to Re^2: regex to find vowels in anyorder
in thread regex to find vowels in anyorder

I think BrowserUk's solution is going to be faster.
That would not be my guess, unless it's the /i that's killing the performance. /a/ will not use the regexp engine, the optimizer will do it. If speed is an issue, and you want to be case sensitive, my bet would go to:
if ((/a/ || /A/) && (/e/ || /E/) && (/i/ || /I/) && (/o/ || /O/) && (/ +u/ || /U/)) { ... }
but I'm too lazy to come up with a good benchmark (which should test for both match and non-match). And if the query set would be English words, I'd order the vowels from least frequently occurring to most frequently (probably u-i-o-a-e, but I'd have to look that up), in order to fail faster.

Of course, it's also very likely speed doesn't matter at all.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-25 05:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found