Language Injections Matching
Hello, I've been feeling really stupid trying to add a pretty simple custom language injection. Instead of the default SQL Select Injection (" *SELECT .*FROM .*"
), I want to exclude any literal that includes %s. Should be simple enough, but the regex matching behaves very unpredictably and I was unable to find any documentation. I've tried excluding “%” specifically, using [\w], [a-zA-Z0-9_], etc. instead of the .*
between select and from, but basically nothing works as expected.
The only thing I've got working is " *SELECT [a-z_]* FROM .*"
, but any other expression should work aswell, no? To be clear, [a-z_]
works, but [a-zA-Z_]
doesn't. What am I missing?
Also: How do escapes work? The \
from \w
is removed on save, but \\w
doesn't seem to work either.
Thanks.
Please sign in to leave a comment.
I would appreciate an answer. If this is the wrong forum or somehow a stupid question, please let me know.
Hi,
Sorry for the delay.
It's a Java regexp syntax, please see: https://www.jetbrains.com/help/idea/regular-expressions.html#regex-syntax-reference
In that case, you might use similar to
+ goStringLiteralThatMatches(" *SELECT .*[^%][^s] FROM .*")