-
I'm writing a spam-checker that, among other things, uses For instance, "arian" (sic) is a keyword used by neonazis. Having the word "arian", even as part of another word ("proudarian"), should raise the suspicion on the message. On the other hand, "hungarian" or "libertarian" shouldn't flag as uses of the word "arian". So, I'd like to be able to write something along the lines of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
What you're asking for is essentially negative lookbehind, but absence of lookarounds if one of notable and documented limitations of this crate and similar approaches:
It might be easier to use a regex engine that does support those features, or, alternatively, you'd have to match all |
Beta Was this translation helpful? Give feedback.
-
@Yoric Indeed, it does sound like you're asking for negative look-around. That will never be added to this regex engine, as mentioned in the docs. To me, it kind of seems like it would be very easy to accomplish your task using two regexes: one to find "arian" and another to filter out whitelisted uses of it. If you need help doing that, i'd be happy to take a look at a minimal example in code of what you're doing. |
Beta Was this translation helpful? Give feedback.
What you're asking for is essentially negative lookbehind, but absence of lookarounds if one of notable and documented limitations of this crate and similar approaches:
It might be easier to use a regex engine that does support those features, or, alternatively, you'd have to match all
\b\w+ar[iy]an\b
and then manually filter out the know-to-be-ok ones.