Solved

Regular Expression that detects WORDS \w with no vowel in it

Posted on 2003-12-02
6
591 Views
Last Modified: 2012-05-04
I can think of some parts needed to detect a word with no vowels in it, but can't figure out the whole thing (it's early!)..

I was thinking something along the lines of,

(\w[^a|e|i|o|u])

But thats not it...
0
Comment
Question by:Tacobell777
  • 4
  • 2
6 Comments
 
LVL 31

Accepted Solution

by:
GwynforWeb earned 50 total points
ID: 9862320
/\W[^aeiou]+\W/i
0
 
LVL 17

Author Comment

by:Tacobell777
ID: 9862435
You rock!
Thanks

Stupid of me, ofcourse [^a|e|i|o|u] is a class so no OR | needed..

Ok, so your regex says

Non word characters - No aeiou At least once - Non word character

It doesn't make sense to me? It works, but I'd like to understand it too..
0
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 9862438
eg

<script>
reg=new RegExp(/\W[^aeiou]+\W/)
alert(" abcd " + "\n" +reg.test(" abcd "))
alert(" wxyz " + "\n" +reg.test(" wxyz "))
</script>
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 31

Expert Comment

by:GwynforWeb
ID: 9862444
Thanks GfW
0
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 9862506
It says

Non word characters - a sequence of non aeiou's   - Non word character

ie having a vowel between the nonword chars returns false
0
 
LVL 17

Author Comment

by:Tacobell777
ID: 9862624
Cheers...
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question