Skip to main content
gamedev.net
🔒 Locked

Advanced Regular Expression Help

Started by LuckyOne Dec 7, 2005 at 1:16 PM 1 replies 650+ views
Original Post
LuckyOne
LuckyOne
Can someone please write me a Regex that: 1)Match all characters except AEIOU [^AEIOU] 2)And all except (W) and (Y) (with brackets) It should be One regex.
Zahlman
Zahlman
/[AEIOU]|\([WY]\)/ (in Perl notation) will match a string which contains either of those things. Then invert the logic in your code so that you do whatever if the pattern is *not* matched. General "and" logic is hard to do with regexes in general ("followed by" is easy, but "and" requires re-scanning the string); "or" logic is easier, so it's usual to set things up this way.
kSquared
kSquared
LuckyOne, this sounds too much like a homework problem. Even if it's not one, it doesn't really meet this forum's minimum standard of asking a question which you could figure out with a little bit of work and research. Closed.
- k2 "Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ<

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.