in reply to data between brackets

I think that's on the right track...

Also, take care to make your regular-expressions as specific as possible, so that you don't run into “false positives.” Don't simply test your logic on good data.

For much the same reason, I suggest that you probably want to extract the desired information from the input-record without replacing the input-record. So, for example, instead of using the “substitute” syntax previously illustrated, I would probably use “extract” syntax, then grab the value from $1 so that now I had both the original value and the extracted data.

It is a good idea to be as specific about the character-types that you expect, e.g. within those parentheses. Sure, “*” will accept anything, but if you accept “anything,” how will you ever discover “the glitch that has crept into a crucial 2.6% of the 1.3 million records in your input-data?” (Just kidding, but... programs that parse input-data have “the last clear chance” to discover the hidden data-flaws now that you do not want the auditors to be looking-for six months from now, if you catch my drift.)