permaculture playing cards*
The moose likes Beginning Java and the fly likes Need Regular Expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need Regular Expression" Watch "Need Regular Expression" New topic
Author

Need Regular Expression

kayanaat sidiqui
Ranch Hand

Joined: Sep 04, 2008
Posts: 122
Hi,

In my code i have a string.
Now in this string i need to print a warning message, if contains
any character other than (A-Z,a-z,0-9,_)

I tried to do with contains([A-Za-z0-9_])and pattern().
But could not get through.

Where am i doing mistake. Can you please point it out..

Tahnks,
Kaya.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Check the API of java.util.regex.Pattern. It clearly specifies how to create an "Any character except" character class.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Regular Expression
 
Similar Threads
Check if a String has alphabets
Problem using Pattern and Matcher (REGEX)
Problem using Pattern n Matcher (REGEX)
java.util.regex.Pattern
how to string search ?