Blocking email address with regular expression not working

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:

\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b

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