• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regular expression  RSS feed

 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the following regular expression to verify it the string has all characters as part of number or not.

As I am not adept at RegEx can somone please verify and tell me if the below will fail under any conditions ?



thanks,
Shivani.
 
Alan Moore
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks good to me. The only possible problem is that it will also match an empty string. If that isn't acceptable, this regex requires at least one digit:
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are some other strings you may or may not feel you need to handle. All are valid numbers in some context:

-1
1.
12,345,678.00
12.345.678,00
1.2e6
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!