Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

simple regex problem  RSS feed

 
Shilpa Tendulkar
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the code \\d stands for degit.

Try this
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More precisely, "\\d" matches only one digit. If you want to match one or more digit, you'll have to add "+" quantifier.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!