I am using TextMate to replace expression [my_expression]
consisting in characters between open and closed brackets by {my_expression}
; so I tried to r
You forgot to escape a character, [^]]
should be [^\]]
.
You also need a capture group. $1
is back-referencing the 1st
Capture Group, and you had no capture groups, so use the following Regex:
\[([^\]]*)\]
This adds ()
around [^\]]*
, so the data inside the []
is captured. For more info, see this page on Capture Groups
However, this RegEx is shorter:
\[(.*?)\]
Also substituting with {$1}
Live Demo on Regex101