What is the Regular Expression to find the strings starting with [ and ending with ]. Between [ and] all kind of character are fine.
See Question&Answers more detail:osWhat is the Regular Expression to find the strings starting with [ and ending with ]. Between [ and] all kind of character are fine.
See Question&Answers more detail:os[
and ]
are special characters in regular expressions, so you need to escape them. This should work for you:
[.*?]
.*?
does non-greedy matching of any character. The non-greedy aspect assures that you will match [abc]
instead of [abc]def]
. Add a leading ^
and trailing $
if you want to match the entire string, e.g. no match at all in abc[def]ghi
.