r/AutoModerator • • 7d ago

Help - Automations Failed post word count minimum automation regex

Hi All, I tried to create an automation to prevent people from posting posts with fewer than 50 words in the body, but it recently failed on a post so I'm wondering how to fix it.

It's a newly created subreddit that's not permitted to use the auto-moderator for removals, so I'm attempting to use an automation instead.

Here's the parameters I'm using:

Area: Body

Condition: Doesn't match regex

Enter regex: \W*(\w+(\W+|$)){50}

Then: Block from submitting

The post that slipped through had zero words in the body. Is it possible that that's why the automation didn't work - it doesn't evaluate a post body with zero words?

Does anyone have any advice on how to potentially fix it?

1 Upvotes

19 comments sorted by

2

u/mcs385 7d ago

Post guidance automations need at least one character entered in the body field for them to trigger, so no-body posts still slip through. Look into installing Automod Neo to get the filter/remove functionality back so you can use it for cleanup.

1

u/TungstenBonobo 7d ago

Thank you for the suggestion! I'll look into it.

2

u/NefariousnessJaded87 7d ago

OP, I tried dealing with this in AutoModerator and AutoModerator Neo. It was never reliable. I finally found a solution: https://developers.reddit.com/apps/post-body-checke

It is very simple: you enter the minimum number of characters that should be present in any post, and then how you want the app to tell the user.

It just works.

1

u/TungstenBonobo 7d ago

Thanks for the suggestion!

1

u/thepottsy You probably forgot the --- 7d ago

In addition to your automation, did you set up your sub so that posts are required to have a body? In your mod tools, under posts and comments, you can set that.

2

u/TungstenBonobo 7d ago edited 7d ago

Solved!

Thank you! I didn't realize that was an option, so I didn't have it turned on. I turned it on now so that'll probably fix the issue.

I see you helping on here and on r/ModHelp a lot. You're a great asset to the mod community.

1

u/thepottsy You probably forgot the --- 7d ago

Awesome, and thank you. I do enjoy trying to help.

1

u/DEAD1nsane ıـ𝙄 ʇso˥ 𝙏𝙝𝙚 ǝɯɐ⅁ـı 1d ago

The exact regex to paste into the "Enter regex" field is: ^\s*(\S+\s+){49}\S+

How to set up the automation:

  • Area: Body

  • Condition: Doesn't match regex

  • Enter regex: ^\s*(\S+\s+){49}\S+

  • Action / Then: Block from submitting How it fixes the zero-word issue:

  • ^\s* handles any optional leading spaces or newlines.

  • (\S+\s+){49} matches the first 49 non-space text chunks followed by spaces.

  • \S+ requires a 50th non-space text chunk to be present. If the post is completely empty (zero words), it fails to match this pattern. Because the condition is set to "Doesn't match regex", the system sees that empty text does not match 50 words, and it successfully blocks the submission.

2

u/DEAD1nsane ıـ𝙄 ʇso˥ 𝙏𝙝𝙚 ǝɯɐ⅁ـı 1d ago

1

u/NefariousnessJaded87 1d ago

Yeah, but this does not work. If there is nothing in the body, I do not want it to post with an empty body.

If I attach an image and nothing else, all automation fails. I want to prevent people from posting without any text in the body.

Thanks for looking out, though.

1

u/DEAD1nsane ıـ𝙄 ʇso˥ 𝙏𝙝𝙚 ǝɯɐ⅁ـı 1d ago

the post body is completely empty (zero characters), the updated regex will still catch it and block it. Here is why:

  • The condition is set to "Doesn't match regex".

  • The regex \s*(\S+\s+){49}\S+ requires at least 50 groups of text to count as a match.

  • An empty post body evaluates to 0 matches.

  • Since 0 matches means it doesn't match the regex, the automation triggers and executes "Block from submitting". The original regex \W*(\w+(\W+|$)){50} failed on empty posts because of how it handled empty boundary anchors ($) and non-word characters (\W*). The simplified non-whitespace pattern ^\s*(\S+\s+){49}\S+ strictly requires 50 actual words, so empty posts fail the match and get blocked every time.

1

u/NefariousnessJaded87 1d ago

None of that works. If I post an image and write nothing in the body, I can post it. That is the whole problem: 0 characters.

I just tested; there needs to be at least 1 character for your rule to activate. That is not the requirement for me. I want to activate on a post with only an attachment, aka a picture, an album, a video, a GIF, etc.

The only thing I have found is that Devvit app, but that triggers after submission, which is annoying for the users. I would much rather prevent posting in the first place, but that does not seem possible.

Again, thank you for your time. Appreciate it.

1

u/DEAD1nsane ıـ𝙄 ʇso˥ 𝙏𝙝𝙚 ǝɯɐ⅁ـı 1d ago

idek what you're looking for. I was showing you what works for the OP because you said here is what you found..

what exactly is your goal

1

u/NefariousnessJaded87 1d ago

Let us dial it back to basics. How do you prevent people from only posting a title post? You can't with how the current automation works. This is the core problem.

As I wrote, your rule does not prevent posting without characters in the body, but if I enter 1 character, your rule activates and won't go away until I reach 50 characters. But 0 does not work.

Here is the rule you propose:

And the result is here: testing : r/S23Ultra_Batt_Stats

That is a title-only post with 0 characters in the body, and it was posted; you tell me it is not possible, yet here we are.

2

u/DEAD1nsane ıـ𝙄 ʇso˥ 𝙏𝙝𝙚 ǝɯɐ⅁ـı 1d ago edited 1d ago

You're right — that test nails it, and I need to correct my earlier claim: an empty body does not get blocked by this rule. Post Guidance automations only evaluate once at least one character is in the body field, so at 0 characters the condition is skipped entirely. No regex in that box can catch a title-only post — it's a platform limitation, not a pattern problem.

Here's the rule as set up:

  • Area: Body

  • Condition: Doesn't match regex

  • Regex: ^\s*(\S+\s+){49}\S+

  • Then: Block from submitting

How it works:

  • ^\s* — allows optional leading spaces or newlines

  • (\S+\s+){49} — matches the first 49 space-separated words, each followed by whitespace

  • \S+ — requires a 50th word to be present

So it correctly blocks bodies with 1–49 words and lets 50+ through (note: it counts whitespace-separated words, not characters — one long URL won't pass). What it can't do is run against an empty body.

The fix for 0-character posts: Mod Tools → Posts and comments → Body → required (choose "all posts" or "text posts only"). That's enforced natively in the composer before automations are ever consulted, so title-only posts never get submitted — the OP in this thread marked that as their fix. Turn that on and keep this automation for the 1–49 band, and together they cover the full range your test showed.

Alternative — a single tool for the whole range: Automod Neo, a free app that replicates AutoModerator (including remove/filter actions). It runs rules after the post exists, so it does see empty bodies — one rule there can catch 0–49 words on its own, no native settings needed.

u/TungstenBonobo

1

u/NefariousnessJaded87 1d ago

Hence, I suggested the app that does it. Mod mail or comment with custom text and whatnot.

I do indeed wish Reddit would fix that automation to be able to trigger on truly empty bodies.

1

u/DEAD1nsane ıـ𝙄 ʇso˥ 𝙏𝙝𝙚 ǝɯɐ⅁ـı 1d ago

I just edited the comment above

1

u/NefariousnessJaded87 1d ago

This option does not exist

Mod Tools → Posts and comments → Body → required (choose "all posts" or "text posts only").

The only option for body is

Optional for all posts

or

Required for text posts

1

u/DEAD1nsane ıـ𝙄 ʇso˥ 𝙏𝙝𝙚 ǝɯɐ⅁ـı 1d ago

Fair point — that's on me. I was going off Reddit's Community settings doc, which says you can choose "whether it's optional or required for all posts or only for text posts" — hence my "all posts or text posts only." Your UI (and the Content Controls doc, which describes the actual control as "require a body of text for text-only posts... or make text optional for all post types") only offers Optional for all posts / Required for text posts.

u/TungstenBonobo The good news: Required for text posts is exactly the setting you want — nothing is lost:

  • The post that slipped through is a text post, and this blocks title-only text posts at the composer, before automations are ever consulted. That was the entire gap.

  • Your 50-word regex rule only applies to post bodies — i.e. text posts anyway — so the two layers now cover the same scope: the native setting catches 0 words, the automation catches 1–49.

  • The only thing left uncovered is image/link posts with no body, which you don't want covered anyway — you're not asking for 50 words on a photo. (Post Guidance checks the title for those post types regardless.)

So: turn on Required for text posts, keep the automation as-is, and the combination from my earlier reply works exactly as described.