View Single Post
 
Old 07-21-2021, 04:13 PM
Peterson Peterson is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Jan 2017
Posts: 143
Peterson is on a distinguished road
Default

To keep the parentheses, commas, and dashes black, do the following four find/replaces:

Find: ([\(])([0-9\-,]{1,})([\)])
Replace with: \1qq\2\3qq
Leave box empty but set font format to red
Wildcards On


Find: ([\(])(qq)
Replace with: \1
Leave box empty but set font format to auto or black
Wildcards On


Find: ([\)])(qq)
Replace with: \1
Leave box empty but set font format to auto or black
Wildcards On


Find: [,\-]
Set the font color to red
Replace with: Leave blank
Set the font color to black or auto
Wildcards On



NOTES:
  • The "qq" is dummy text, to make sure that the only parentheses found/replaced are the ones surrounding your numbers. I am assuming that there's a possibility that you have other, red text that you do NOT want altered.
  • You have to do this in four steps because, while you can search for multiple items in a string (by grouping them in parentheses), you cannot selectively apply formatting to only a portion of the string, i.e., you can't apply red to the numbers while leaving the parentheses black.
  • If you do NOT have other colored text, then you can do all of the above more simply, as follows:


Find: [\(][0-9\-,]{1,}[\)]
Replace: Leave blank
Set font color to red
Wildcards On



Find: [\(\)\-,]
Set font color to red

Replace with: Leave blank
Set font color to black or auto
Wildcards On
Reply With Quote