Blocking email address with regular expression not working

Hey all,

the blocking of posts with regular expressions is not working anymore. The RegEx Test Tool is finding that mail-address but users are able to post mail-addresses:

RegEx: (^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)


Is that a bug?

Thanks a lot for your help!

1 Like

I think there is a problem with that regular expression. It looks like it will fail unless the email address is posted on its own line in the composer. You can confirm this by adding some text other than an email address when you test the regex on Discourse. Even just adding a space before the email address will cause it to fail.

Here’s a regular expression that should work for email addresses:


For reference, I found that regex here: How to Find or Validate an Email Address.

1 Like

Thanks! That’s working. Now another problem: Is it possible to use that RegEx for public posts only? Now it’s not possible to send mail-addresses through private messages as well. This is an unfortunate behavior.

1 Like

No, it is not possible to only have watched words applied to public posts. With that regex in place, you’ll need to get your users to enter email addresses in a way that doesn’t get matched by the regex. Maybe something like adding a space before the @ character would work.

1 Like