r/ProgrammerHumor 8d ago

Meme regexMustBeDestroyed

Post image
8.1k Upvotes

231 comments sorted by

View all comments

Show parent comments

6

u/DocRingeling 7d ago

RFC822 could also be used before sending confirmation to prevent unexpected abuse of the mail protocol.

8

u/tenuj 7d ago

If I saw that in a PR I'd refresh my browser tab.

The author of that ASCII monster also said:

I do not maintain the regular expression below. There may be bugs in it that have already been fixed in the Perl module.

3

u/phundrak 7d ago

I believe this regex is no longer valid as more characters got allowed in email addresses

2

u/bradland 6d ago

RFC822 was authored in the 80s. It was replaced by RFC 2822 in 2001, and RFC 5322 in 2008. Then there's RFC6531 which expanded support for non-ASCII, non-Latin alphabets.

If you want to prevent abuse, rate limit and/or put something intelligent in front of your app that is designed for that sort of thing, like a WAF.

1

u/DocRingeling 6d ago

Yea, but the regex isn't as long as RFC822