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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details 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
   Displaying page 1 of 1 pages; Items 1 to 1

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