2 ms·
Completely useful, as part of a two step process:1 1. Filter with the regex - what's left has a valid format, making step 2 much saner. 2. Extract and validat
by PeterWhittaker 12y ago
Completely useful, as part of a two step process:1
1. Filter with the regex - what's left has a valid format, making step 2 much saner.
2. Extract and validate the domain name - super simple now, because the domain component is known to be sane.
(Optional but good idea 3: Handle exceptions....)
Step 1 is almost always the hardest part, now it's mostly done.
- Piskvorrr 12y agoThe assumption here is "0. create a regex that does not have false negatives". You seem to be taking the author's word for the "99.9% Works" part - based on what? (Exactly.)
- PeterWhittaker 12y agoCorrectness and utility are two different things, feel free to investigate the former whilst we discuss the latter....
- Piskvorrr 12y agoWell thank you, I doubt I would have come to such conclusion by myself. Are you saying that "turn away 0.1% of your customers" is a useful approach? Well, your call, I guess.
- PeterWhittaker 12y agoWhoa, there: You're shifting your argument. Are you now accepting that it is 99+% correct? Your original objection was as to the correctness of the regex. If it is 80% good, then, yeah, your underlying assertion is likely good: Too little coverage to be all that useful. But 99+% coverage? For a quick pass filter? That's pretty good, we can work with those numbers. After all, one could have multiple layers of progressively more accurate but progressively slower filters. Not an uncommon or unusual approach. Besides, the JS version could be very useful as a quick pass usability check, validating whether the user made a silly mistake. And adding some logic to record the bogus entry, compare it to what they write next, pass it to the server if need be, can all be very useful.