Re:Natural occurring molecule rivals Ozempic in weight loss,...
by sgc on Friday March 07, 2025 @09:28AM
(#43290444)
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.
[ Parent
| on HN ]
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by dleeftink on Friday March 07, 2025 @09:34AM
(#43290478)
You'll love this one then!
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by sgc on Friday March 07, 2025 @10:18AM
(#43290833)
I 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.
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by trehalose on Friday March 07, 2025 @10:13AM
(#43290788)
That 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]+).
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by jcl on Friday March 07, 2025 @10:49AM
(#43291124)
It 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”.
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by Izkata on Friday March 07, 2025 @03:34PM
(#43294288)
"*" 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]
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by genewitch on Saturday March 08, 2025 @02:11AM
(#43298201)
There was a product called the eeePC or so. It was a "netbook."
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by card_zero on Saturday March 08, 2025 @02:22AM
(#43298257)
The Asus product line, yes (all three Es apparently stand for "easy"). But Asus write it with a capital E on the front. Still, somebody else might not.
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by dleeftink on Friday March 07, 2025 @10:15AM
(#43290801)
It'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!
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by jpc0 on Friday March 07, 2025 @09:49AM
(#43290606)
Remember to get a license for your code
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by jasonjayr on Friday March 07, 2025 @09:58AM
(#43290685)
On the list of disasters, they forgot "parsing html":
https://stackoverflow.com/questions/1732348/regex-match-open...
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by joseda-hg on Friday March 07, 2025 @10:32AM
(#43290961)
Huh, I tried sharing the Zalgo answer here, but it didn't quite work, never knew HN wouldn't render those kinds of characters
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by qingcharles on Friday March 07, 2025 @01:03PM
(#43292437)
It 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.
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by genewitch on Saturday March 08, 2025 @02:12AM
(#43298204)
o, there's your problem. Only half is supposed to go over the top. The rest is supposed to go below.
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by binarymax on Friday March 07, 2025 @10:28AM
(#43290914)
> Licenses: “No regex licenses have been issued at this time.”
Perfect
Re:Natural occurring molecule rivals Ozempic in weight loss,...
by sgc on Friday March 07, 2025 @01:32PM
(#43292798)
Just license 007: License to kill.