Hey! ast-grep author here. I believe what you want is probably what https://github.com/ast-grep/ast-grep can help you.
More specifically for the "string constant" search/replace, you can see the playground example!
https://ast-grep.github.io/playground.html#eyJtb2RlIjoiUGF0Y...