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
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: 195

In the code \\d stands for degit.

Try this

Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

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
It's not a secret anymore!