aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "simple regex problem" Watch "simple regex problem" New topic
Author

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

In the code \\d stands for degit.

Try this


SCJP 5, SCWCD 5
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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: http://aspose.com/file-tools
 
subject: simple regex problem