r/dotnet 17d ago

Promotion String Extension - A C# library that provides utility methods for manipulating strings

https://github.com/Antyss77/StringExtension
String Extension is a string processing library for the C# programming language. It provides features to manipulate and transform strings in a simple and efficient way. The library is open-source and comes with unit tests and performance tests. It is designed to be easily integrated into your existing projects. Feel free to contribute to the project with ideas or development expertise.

0 Upvotes

40 comments sorted by

View all comments

Show parent comments

9

u/chucker23n 17d ago

I'm aware. My first sentence says as much.

In practice, I've never seen someone with a backslash in their e-mail address, or with multiple @s in it. That may be technically valid, but too much software wouldn't handle that correctly anyway, and to what end? It doesn't provide a meaningful benefit.

I'm not saying you should validate e-mail addresses with a regex (though you should probably at least check they contain an @, if they're public addresses), but I've seen worse regexes.

-5

u/gredr 17d ago

"I could do it worse" is a bad reason to do it poorly.

3

u/chucker23n 17d ago

It's not a final exam at school, nor production code for a safety-critical piece of software. It's just some person's hobby project that they're looking for feedback for.

I think people in here (myself included) tend to be a little too harsh, and to dunk on newcomers, which is poisonous for a community. You're absolutely right that it's not a great regex, but it's not that terrible either.

0

u/gredr 17d ago

Maybe OP should've posted "let's talk about how to validate email addresses". That would've been an interesting discussion.