# query replace content within brackets

I was trying to re-structure my latex document but I failed to do it in a single query regex. My goal was to the following transformation:

\item[root] → \item \textbf{root}

I tied grouping the content withing the brackets and then using in the replacement but it did not work.

This was my attempt:

Alt-S-% \\[$$.*$$] RET \\textbf{\1} RET

I tried playing with the regexp-builder but it seems to have a slightly different syntax than then replace-regexp command.

\ escapes [ and itself, so \\ matches a backslash and \[ matches an open bracket. So \\[$$.*$$] matches a backslash followed by a dot, a parenthesis or a star.
Instead, you presumably wanted to use \[$$.*$$] which should give you the right result. Rather than re-builder, you can also use:
C-s M-r \[$$.*$$] M-% \\textbf{\1} RET