I stumble upon this great tool a while ago. I was almost sure that I learned about it on this very forum, but no search results are returned for “semgrep”, so I guess it’s the perfect time to introduce it. (maybe it was on the IRC chan?)
To have a quick overview of what semgrep offers, have a look at the examples in the right sidebar of the playground:
I haven’t try to integrate it with Kakoune yet, but I feel confident that semgrep can be used in a nice way to craft multiple selections starting from a search expression in the prompt.