3 ms·
Regex is one of my favorite things to work with. It's surgery. I love having a very specific problem and a very sharp knife. What I hate is chasing down languag
by sgc 2y ago
Regex is one of my favorite things to work with. It's surgery. I love having a very specific problem and a very sharp knife. What I hate is chasing down language or library bugs, or undocumented limitations. Of course I would hate it if I had never used it extensively. Its terseness is harder if you only have to pick it up occasionally.
- jpc0 2y agoRemember to get a license for your code https://regexlicensing.org/ https://regexlicensing.org/
- jasonjayr 2y agoOn the list of disasters, they forgot "parsing html": https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags https://stackoverflow.com/questions/1732348/regex-match-open...
- deleted 2y ago[deleted]
- joseda-hg 2y agoHuh, I tried sharing the Zalgo answer here, but it didn't quite work, never knew HN wouldn't render those kinds of characters
- qingcharles 2y agoIt did, but I kinda went over the top with it once and dang had to tell me off, so it might be they added filtering.
- genewitch 2y agoo, there's your problem. Only half is supposed to go over the top. The rest is supposed to go below.
- binarymax 2y ago> Licenses: “No regex licenses have been issued at this time.” Perfect
- sgc 2y agoJust license 007: License to kill.
- dleeftink 2y agoYou'll love this one then! [0]: https://cardoni.net/parsing-proper-nouns-with-regex/ https://cardoni.net/parsing-proper-nouns-with-regex/
- trehalose 2y agoThat regex detects things like "eeieiieeeiA __ 1 2 3__" as a proper noun. I'm confused by the decision to accept any number of leading [ei] and any number of trailing (?:\s+[_\d]+).
- dleeftink 2y agoIt's not perfect for sure, but perfectly suitable for a first pass and then a dictionary sweep or another set of regexes. I guess I like the compactness of it!
- jcl 2y agoIt only looks for a single leading “e” or “i”, not any number. I’m guessing those tweaks were added to capture specific proper nouns that weren’t captured by simpler “leading capital letter” regexes, like “iPad” or “eBay”.
- Izkata 2y ago"*" is "0 or more" and "+" is "1 or more", it looks for any number of "e" or "i" at the beginning and at least one capital letter. The diagram below the regex is wrong. Instead of [ie]*-?[A-Z]+ it looks like they wanted [ie]?-?[A-Z]
- alienbaby 2y agoYes, once you have a scalpel, everything looks like a very specific problem ;)
- sgc 2y agoThat is the temptation! No requirements, no conventions, no best practices, no nagging boss, just me and total root access to all the files :)