Click here to Skip to main content
15,073,511 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I need to write a regular expression which allows numbers and Comma

Basically user can enter amount with comma and dot like
@20.22 or 2,010.00

Expression which allows numbers is this but now how to modify the expression to satisfy the requirement.
Regex m = new Regex("^[0-9]");

Please let me know the changes for this,thanks in advance.....

Try tools like:
Regexp Editor[^]

Form the regular expressions the way you want. Try it.
It would go something like this:

You'd have to modify that a bit if you want to exclude leading zeros. If you do want to do that, I recommend you take Sandeep's suggestion and look into constructing it yourself using some of the useful tools freely available to you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900