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
Use a capturing group (...)
:
\[([^\]]*)\]
The $1
is a backreference to the text enclosed with [...]
.
Here is the regex demo and also Numbered Backreferences.
Also, the TextMate docs:
1. Syntax elements
(...)
group20.4.1 Captures
To reference a capture, use$n
where n is the capture register number. Using$0
means the entire match.
And also:
- If you want to use
[
,-
,]
as a normal character in a character class, you should escape these characters by\
.