I don't know Regex
ideasof.andersaberg.com
I don't know Regex
1–10 of 55 posts
Re: I don't know Regex
#2Actually, I like neither. The code is easier to read, but the regex gives a broader overview. This is something where parser combinators can shine. E.g., from Haskell's email-validate:
addrSpec = do
localPart
Source: http://hackage.haskell.org/packages/archive/email-validate/1...To end with a positive note: good work on the library! I think it will be useful for many people who dislike writing regexes.
Re: I don't know Regex
#3For more see http://en.wikipedia.org/wiki/Email_address#Valid_email_addre...
Re: I don't know Regex
#4 ^ ( [a-z0-9]+ @ [a-z]+ \. [a-z]+ ) $
With ignore case and ignore whitespace mode on. I work with Regex a lot so I find this very readable, set in a universal format, and more concise. I will gladly concede that the builder would be easier for those that aren't familiar with regex.Re: I don't know Regex
#5Your email regex is wrong. There are some obscure email address that will not work. For example my.email domain+plus@some.weird3.com For more see http://en.wikipedia.org/wiki/Email_address#Valid_email_addre...
Re: I don't know Regex
#6Your email regex is wrong. There are some obscure email address that will not work. For example my.email domain+plus@some.weird3.com For more see http://en.wikipedia.org/wiki/Email_address#Valid_email_addre...
Re: I don't know Regex
#7Your email regex is wrong. There are some obscure email address that will not work. For example my.email domain+plus@some.weird3.com For more see http://en.wikipedia.org/wiki/Email_address#Valid_email_addre...
I think it is clear that this isn't the point.
Re: I don't know Regex
#8Re: I don't know Regex
#9His example could be simplified to ^ ( [a-z0-9]+ @ [a-z]+ \. [a-z]+ ) $ With ignore case and ignore whitespace mode on. I work with Regex a lot so I find this very readable, set in a universal format, and more concise. I will gladly concede that the builder would be easier for those that aren't familiar with regex.
I'd also like to add features, a .Not operator would be really useful, and I'd gladly take a pull request if anyone have an implementation in mind :)
If I receive some signals that others find this library useful and would like me to add some feature, I'd be more than glad to do so.
Re: I don't know Regex
#10For example, it showed that the horrible email regex in this article had a couple of errors - the dot before the TLD should be escaped (without the escape, it's 'any character'), and that group #1 can either be letters or digits, but not both (when it can be).
It's still not a good regex, since there are characters like hyphens, dots, and pluses that are valid pre-'@' characters, which both sample regexes fail to recognise.