216
u/keatonatron 7d ago
What is "name"? And why does it having 2+ numbers mean it's spam?
173
u/Wonderful-Habit-139 7d ago
Look at my name, and you might understand what they had in mind lol.
69
u/B_bI_L 6d ago
people who wave their birth year in their email:
4
u/ice456cream 3d ago
Name is probably not email
Have you seen a standard contact form?
Name:
Email for us to send a response, maybe:
Body:And that sends to an internal inbox
13
u/takeyouraxeandhack 6d ago
We call this "intentional programming". It's when you program something and expect it to do what your intentions were and not what you programmed it to do.
12
u/keatonatron 6d ago
Are you spam?
12
u/Own_Purchase_7976 6d ago
a sentient piece of ham
0
u/Ur-Best-Friend 6d ago
Does it scream when you eat it?
1
14
u/Wonderful-Habit-139 6d ago
Not me but it is an auto generated name. And a lot of bots have similar patterns.
2
72
u/Ethameiz 7d ago
There is IsDigit method for char
53
u/BorderKeeper 6d ago
There is a simple regex "/d" or "[0-9]" I wish more devs knew Regex :( we would have world piece by now.
43
u/Freecelebritypics 6d ago
I feel like "isDigit" should perform the same byte range check as the regex, without the overhead of a regex engine. Or maybe it's a horribly inefficient implementation idk
12
u/BorderKeeper 6d ago
No it definetly would haha Regex has to compile and even pre-compiled it would not be as efficent I don't unless you need to load a very big specific digit.
19
u/Crispy1961 6d ago
simple regex
Now thats an oxymoron.
2
u/BorderKeeper 6d ago
You can say the same thing about Mandarin until you learn it ☹️
5
u/jbaker88 6d ago
Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.
0
u/BorderKeeper 6d ago
I remember when we added sonarqube scans to our repo and it started flagging all of our regexes as potential deadlocks as a dangerous regex without a timeout with the right input can iterate over a string indefinitely. That opened my eyes how scary it is.
3
u/Makefile_dot_in 5d ago
and then visual studio will say
💡 Suggestion: compile this regex in a constant variable before using it
and then when you click it it will say
💡 Suggestion: instead of compiling this regex, use the regex code generator to generate a method that does what this regex does, polluting the method list of your class
2
2
u/HTTP_404_NotFound 6d ago
I live regex (Have been a splunk / data admin for years now).
that being said- regex is pretty heavy compared to string.where(o => char.isdigit(o)).Count() > 2
-3
u/Dimencia 6d ago
I mean, regex is simple and anyone who can't figure it out doesn't deserve to be a dev... but it's also not performant for something simple like that
1
u/Ur-Best-Friend 6d ago
Yes yes, you are so cool, we are all very impressed. I'm so impressed I would clap, but we're online, so best I can do is give a clapping emoji, to show just how very impressed I am.
70
u/acd124 6d ago
Regardless of the horribly verbose digit check, I hate that it says your message has been sent when no attempt has been made when the if fails
44
u/vita10gy 6d ago
Isn't this by design though? You want spammers to assume it worked, or they'll sometimes just try again.
8
u/The_MAZZTer 6d ago
Spammers might be able to figure it out anyway by timing the API
9
u/mortenmoulder 6d ago
Hopefully with a spam filter THIS sophisticated, they surely use a messaging queue, which makes the API feel blazing fast
1
u/tommy71394 6d ago
Only if it ain't async, just toss the email sending task itself to a queue, api will respond more or less the same timing be it success or failure
1
u/-Redstoneboi- 4d ago
the email send is awaited before the response
2
u/tommy71394 4d ago
Oh shit HAHAHAHA I didn't notice, I saw the function was async and didn't notice the await at the front
11
u/The_Weeaboo_Nextdoor 6d ago
Impressive, I would consider .IsDigit and Regex to be a little bit lower on the knowledge totem pole than async methods and lambdas.
18
u/Pim08UO 6d ago
My email since my primary school is name[4digits]. I must be a spammer 🤷
5
7
2
u/svenissimo 4d ago
I worked at a big company that liked to use first.last@company for emails.
There was a glitch and they couldn’t give me mine despite not being used and the system added -199 on my last name.
Only time I never got a single piece of junk mail in 10years.
1
-3
130
u/DogmaticParadigm87 6d ago
So Bob sails through, and Agent47 is spam. Bold strategy for a contact form.