Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I avoid regexes like the plague. I like PEGs as a replacement.


Unfortunatly most stdlib don't have a peg module, and peg libs are complicated.


What would PEG for an email address (like in the article) look like?



I’m aware of PEGs (lpeg specifically), but couldn’t find a real email parsing example myself, hence the question. Most examples on the internet are as cryptic and noisy as regex imo when it comes to pattern matching, so I thought maybe there are other implementations.

I find PEGs useful for actual CFG parsing, but tbh can’t see why I would avoid regex in favor of it in this case.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: