Live data from Hacker News

You Should Learn Regex

blog.patricktriest.com

31–40 of 57 posts

Re: You Should Learn Regex

#31

> From validating email addresses Guys, no. Send an email. https://davidcel.is/posts/stop-validating-email-addresses-wi...

The article you link to addresses just the one use case where you are registering a new user. Email addresses in business applications are just as often NOT the address of your user. Sales contacts, managers, points of contact, customer support addresses, etc. -- none of these should ever be validated by sending an e-mail. So you still need to validate the hard way in plenty of scenarios.

...but unless you actually send an email it is still just as unvalidated as it was before. Regexes aren't a tool to determine that a string refers to a mailbox capable of receiving mail.

If you use regexes (or any other method of that does not send emails) all you're saying is that you don't actually care whether or not the string points to a recipient (much less the correct recipient).

And don't get me wrong. It is absolutely okay to not care whether or not the string refers to a correct recipient. Most places that make me write my email have no business caring about it. But please also then make the field optional.

Re: You Should Learn Regex

#33

> From validating email addresses Guys, no. Send an email. https://davidcel.is/posts/stop-validating-email-addresses-wi...

The article you link to addresses just the one use case where you are registering a new user. Email addresses in business applications are just as often NOT the address of your user. Sales contacts, managers, points of contact, customer support addresses, etc. -- none of these should ever be validated by sending an e-mail. So you still need to validate the hard way in plenty of scenarios.

[deleted]

Re: You Should Learn Regex

#34
For those who prefer a more in-depth introduction than a blog post: Jeffrey Friedl's "Mastering Regular Expression"[1] covers the theory as well while still being very pleasant to read (I only know the first edition, apparently there are more recent ones).

[1] http://shop.oreilly.com/product/9781565922570.do

Re: You Should Learn Regex

#35
post #11

When I used to code in Perl (more than ten years ago) I tended to solve many many things using regexes. I tried to reduce many programming challenges into transformations that I could do via regexes. Why? Because regular expressions are first class citizens in Perl. And Perl made me learn and use them. (Reminds me of a an APL programmer that saw vectors everywhere.) When I replaced Perl with Python in my toolbox I ab…

Regex patterns might not be first class citizens in python, but they're easy enough to use, and I think they're ultimately more powerful than in Perl. I don't remember being able to use a callback to calculate my replace string as a function of the match results when doing substitution in Perl. It's super easy to do tokenization with python regexes. We lose first class patterns, but gain first class functions and classes :)

Re: You Should Learn Regex

#36
I'm not a programmer, but I use Notepad++ and mp3splt, because I have uses for them. This might actually help me use the search functions more effectively.

Re: You Should Learn Regex

#40

OP, your link to http://regex101.com/ is broken. It's my go-to web-app too.

Thanks! It's fixed now.

Also the link in this paragraph:

> The source code for the examples in this tutorial can be found at the Github repository here - https://github.com/triestpa/You-Should-Learn-Rege

has a `href` of `""` which is making it point to the blog post itself.

Post reply on HN