RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find capture numbers with/without commas
Expression
\$(\d*)??,??(\d*)??,??(\d*)\.(\d*)
Description
This captures (for filters out non digits) numbers with or without commas (eg currency as above) in the correct order - the other examples I see here don't capture in right order for all combinations. It doesn't check lengths or leading digits or number of digits between commas- that is left as an exercise for the student. First example gives:[4],[234],[567],[89] Second gives: [],[1],[234],[80] rather than the incorrect: [1],[],[234],[80]
Matches
$1,234,567.89 | $1,234.80 | $34.45 | $1234.5
Non-Matches
$1,234 | $123-45 | $-123.00
Author Rating: Not yet rated. david t
Source zerocred
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials