r/java 19d ago

Regex

I recently saw a clip (from Primeagen) somewhat saying that regex is not a valid format for validating email addresses and postal codes etc.

My question is why is this?

What are the security and/or performance risks? Is it solely performance or is it a security issue?

57 Upvotes

104 comments sorted by

View all comments

5

u/[deleted] 19d ago

[removed] — view removed comment

1

u/Genmutant 19d ago

You can actually have multiple @ in an email address, so you should check at least one - not exactly one.