>>594
https://glot.io/snippets/ggykutt927

import pegs

echo "[あああ(いいい)]".replacef(peg" '[' {@} '(' {@} ')' ']' ","[$2]($1)")

でいける