This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Regular Expression

 
kayanaat sidiqui
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the API of java.util.regex.Pattern. It clearly specifies how to create an "Any character except" character class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic