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 Children
  • I asked you if this was a search and replace and you said yes.  It will not achieve what you're after with the Regex Match AutoSuggest Provider.  I thought you were letting Studio do it's thing and needed to run a search and replace afterwards.

    To do what you want in the regex autosuggest provider I think you'll need to create multiple rules... maybe something like this:

    \b(\d{1,3})\s(\d{1,3})\s(\d{1,3})\s(\d{1,3})\b

    $1,$2,$3,$4

    \b(\d{1,3})\s(\d{1,3})\s(\d{1,3})\b

    $1,$2,$3

    \b(\d{1,3})\s(\d{1,3})\b

    $1,$2

    Maybe someone else has a clever way of doing this in one... would love to know what this would be myself!

  • When I think about it, what I wanted would not really save me any time. Hitting ctrl+, and then Enter will give me the correct number in the target segment, and it is exactly the same number of keystrokes as hitting 2 and then Enter using Regext Match. Still, thanks for looking into it for me.

  • 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