-2

I have an entire macro that searches for every cell in a column and sets the font color of any text between the two parenthesis () or two square brackets []. What i would like to know is what is the regEx.Pattern if i want to set the font color between two vertical bars (pipes) such as "| colored font goes in here |". And while am at it what about a regEx>Pattern that does the same thing but for the less than and greater than symbols, such as < colored font goes here >.

Here is the regEx.Pattern for the parenthesis: "\([^)]*\)"

Here is the regEx.Pattern for the square brackets: "\[[^]]*\]"

I tried replacing the second symbol from the left and the fifth symbol from the right (excluding the quotation marks) with the vertical bars or the less than and greater than symbols but it doesn't work. I searched for a solution on the net but could no find one. All i need is the two regEx.Patterns. Any help would be appreciated.

Thank you.

D Bryce
  • 13
  • 3

1 Answers1

0

You need to escape the | and <> characters with \:

\|[^\|]*\|

\<[^\<\>]*\>

Try to use Regex testers such as https://regex101.com/

Алексей Р
  • 7,507
  • 2
  • 7
  • 18