This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes simple regex problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "simple regex problem" Watch "simple regex problem" New topic

simple regex problem

Shilpa Tendulkar
Ranch Hand

Joined: Jul 29, 2001
Posts: 75
Hi All

I am stuck with this simple regex. Here is my code

wheather string is 123 or 123a, it always prints non numeric..

Any clue???
Prabhakar Reddy Bokka
Ranch Hand

Joined: Jul 26, 2005
Posts: 189

In the code \\d stands for degit.

Try this

Christophe Verré

Joined: Nov 24, 2005
Posts: 14687

More precisely, "\\d" matches only one digit. If you want to match one or more digit, you'll have to add "+" quantifier.

[My Blog]
All roads lead to JavaRanch
wood burning stoves
subject: simple regex problem
Similar Threads
Regular expression to check for specific special characters (any repitition) and 0 to 9 numbers
Another Dan's erroneous definition?
A simple RegEx just doesn't make sense...