7 ms·
My relationship with RegExp seems to be against the grain here. They're almost always a quick, simple, clean solution to any text parsing issue I've faced. Pe
by seph-reed 6y ago
My relationship with RegExp seems to be against the grain here. They're almost always a quick, simple, clean solution to any text parsing issue I've faced. Perhaps without tools like https://regexr.com/ https://regexr.com/ I would feel different though?
- xwdv 6y agoYou almost certainly would feel different.
- sushshshsh 6y agoI find that I can solve most of my jira tasks in 10 mins with string.length and string.charAt() My estimated time to completion with regex is literally undefined
- Moru 6y agoThat's just unfamiljarity. Whatever works for you is good. Sometimes the hammer does work on the screw, you just have to use it right. Or we might end up with https://xkcd.com/927/ https://xkcd.com/927/
- sushshshsh 6y agoWe're all unfamiliar with assembly and electrical engineering too right, should we all invest the time to learn how to program bare metal? Only when the performance is needed, right?
- Moru 6y agoNo, you completely misunderstood and went off on a tangent. My comment means the exact opposite to what you understood.
- Joeboy 6y agoI've never used tools like that and I feel the same. Regexes provide a simple, well supported solution to a huge number of problems, and I'm not sure what the second problem is supposed to be. The quote is fun, and I've sometimes used variants of it, but I don't get why the target is regular expressions.
- Moru 6y agoThe second problem comes when the regex fails because of the edge cases you didn't think of shows up. :-)
- blacksmith_tb 6y agoIt may have something to do with the complexity/inconsistency of the strings you're matching. I feel like often regexes work fine for me with a little fine-tuning, but I have certainly run into examples in code I didn't write (or even code I did, months or years ago) which took me a lot of time to really wrap my head around.
- pdpi 6y agoHave you tried parsing an email address with a regex? http://emailregex.com/ http://emailregex.com/
- Joeboy 6y agoHave you tried parsing an email address (in an RFC compliant way) without a regex?
- deckard1 6y agoto be fair, the email RFC is a silly document that does silly things. The user part of an email address "may" be case-sensitive. But in practice, no one does that. Because imagine grandma on the phone with her bank not remembering if her email address was Mary123@gmail.com, MARY123@gmail.com, or mary123@gmail.com. The horror.
- layer8 6y agoSome systems (used to) map the local part to local unix usernames, which are case-sensitive. Hence the sender would get a 550 No such user (or similar) if he got the case of the local part wrong.
- andyjpb 6y agoYes! http://wiki.call-cc.org/eggref/4/email-address http://wiki.call-cc.org/eggref/4/email-address https://bitbucket.org/knodium/email-address/src/master/email-address.scm https://bitbucket.org/knodium/email-address/src/master/email... It's a fair few lines of code but most of it comes directly from the RFC. It's also longer than it could be because it covers the entire RFC822 syntax, including groups, lists, routes, comments and To: header styles.
- DonHopkins 6y agoHave you tried parsing a regex with a regex? http://regexregex.com/ http://regexregex.com/ [WARNING: DO NOT CLICK THAT LINK OR YOU WILL BREAK THE INTERNET!]
- corpMaverick 6y agoIMHO. They are very practical as long as they stay simple. But there is a threshold you shouldn't cross.
- SoSoRoCoCo 6y agoYou're not wrong. I think OP is a generalized rant that is a bit dismissive of problem solving diversity. I think OP's gist is: if you don't understand a tool, don't use it. But even that is specious. Normal regular expressions have been around since Kleene, Chomsky and Russell started framing them in the 40s/50s. They are a powerful tool for lexical analysis, PERL showed us that in the early 90's. Dismissing them is just gatekeepy, IMHO.