Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio find and replace right square bracket ] in character class

I want to make a negated character class to match a square bracket tag like this [square bracket tag]. The problem is, the ] character ends the character class!

I tried

\[[^\]]+]

but I get a syntax error when I run it. (This is in the find and replace regex engine which is slightly different than the standard .NET engine fyi).

like image 414
just.another.programmer Avatar asked Jul 11 '12 07:07

just.another.programmer


1 Answers

You forgot to escape the final end bracket:

\[[^\]]+\]
like image 175
Damien_The_Unbeliever Avatar answered Nov 16 '22 03:11

Damien_The_Unbeliever