Comment

Comment by jsrn

> because those who can benefit from this kind of basic regexp examples are also those who will not understand the limitations.

I share your sentiment. The article is certainly useful for learning regexps. But IMHO it should also point to the correct way of doing things - often, the correct way is using a module and thus the resulting code is not much longer than the code in the article. For email address validation:

    use Email::Valid;
    print (Email::Valid->address('[email protected]') ? 'valid' : 'invalid');
as a oneliner:

   perl -MEmail::Valid -E"say (Email::Valid->address('[email protected]') ? 'valid' : 'invalid');"
Other than installing the Email::Valid module with a

    cpanm Email::Valid
it is not much longer than the example in the article.

https://metacpan.org/module/Email::Valid

parent jsrn 15 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton