Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes HTML, CSS and JavaScript and the fly likes Regular expression for allowing space, . , @ ,_ and , - Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Regular expression for allowing space, . , @ ,_ and , - " Watch "Regular expression for allowing space, . , @ ,_ and , - " New topic
Author

Regular expression for allowing space, . , @ ,_ and , -

Pramod Krishna Murthy
Ranch Hand

Joined: Jun 30, 2009
Posts: 37

hi all,
i need a regular expression to validate a text field which allows alphabets,numerals and special characters(@,&, . , _, space, -) . can anyone help please


"Nothing is forever except Change"
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

It sounds like you want \w (word) characters plus a few others. What do you have so far? Do you have a regular expression for just numbers maybe? Show where you get stuck so someone can help from that point rather than writing the whole thing for you.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Regular expression for allowing space, . , @ ,_ and , -