File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
I agree. Here's the link:
subject: simple regex problem
Similar Threads
Another Dan's erroneous definition?
Regular expression to check for specific special characters (any repitition) and 0 to 9 numbers
A simple RegEx just doesn't make sense...