This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
I've been learning a lot of regex as I learn to code the automoderator, and by now have made dozens of working pieces of code. Hooray for me!
...But I notice that when I put terms inside word boundaries (to avoid having them caught as part of a longer word), it seems to fail to detect them.
For example, I have a 'mark as NSFW' action that checks for sexual words and automatically marks the post as NSFW. But because many short words (like "rape") can lead to false positives (like "grape" or "trapezoid"), I add word boundaries to them, like so (list shortened):
#Adds NSFW flair to sexual and drug-related topics
type: submission
title body (includes, regex): [
"\bporn\b",
"pr0n",
"pa?edophil(e|ia)",
]
set_nsfw: true
---
The code works fine for words that don't use \b, but fails for ones that do - I've seen multiple posts with "porn" in the title or body slip through without being marked NSFW, for example.
Does Reddit not let you use word boundaries? Is there an alternative code I could use instead?
Subreddit
Post Details
- Posted
- 4 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/AutoModerat...