RegEx to match comma separated numbers with optional decimal part
This: \d{1,3}(,\d{3})*(\.\d\d)?|\.\d\d matches all of the following numbers: 1 12 .99 12.34 12,345.67 999,999,999,999,999.99 If you want to exclude numbers like 123a (street addresses for example), or 123.123 (numbers with more than 2 digits after the decimal point), try: (?<=\s|^)(\d{1,3}(,\d{3})*(\.\d\d)?|\.\d\d)(?=\s|$) A little demo (I guessed you’re using PHP): $text = “666a 1 fd 12 dfsa … Read more