4 ms·
You'll love this one then! [0]: https://cardoni.net/parsing-proper-nouns-with-regex/ https://cardoni.net/parsing-proper-nouns-with-regex/
by dleeftink 2y ago
You'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]
- sgc 2y agoI have done something similar before, to help form an index for a large book. This is what I would consider a relatively simple regex. The harder ones I have dealt with are those looking for malformed syntax where the closing mark that might be missing could be several thousand characters after the opening mark, or the opening mark itself might be missing, across a data set that is several hundred million characters. So you need something very complex to find all the distinctive characteristics of the content that is supposed to be enclosed - while avoiding the many similar structures that give false positives. Sometimes the technically easier solution is too slow to run (look ahead and look behind, etc), so you need to pivot and use other regex features. It can take a day or two to get right.