thousand separators in Regex Match Autosuggest Provider

Could someone give me the regex pattern and replacement pattern to replace blank thousands separators with commas? That is to say, 15 789 489 with 15,789,489.
Thanks.

Parents Reply
  • This is an interesting problem that should be easy to solve! 
    The best approach I can suggest is hardly clever, more "brute force" with 2 generalised regexes

    regex 1: \b(\d{1,3})(\s(\d{3}))?(\s(\d{3}))?(\s(\d{3}))?\b
    replace string: $1,$3,$5,$7

    This handles numbers up to 10**12

    The following regex cleans up the superfluous commas

    regex 2: ((\d)*(,\d)*),*()
    replace string: $1$4

Children
No Data