Hacker News new | past | comments | ask | show | jobs | submit login

I tested the 44k optimised Perl regexp but it seemed to let through some other stuff - i.e. replacing the leading 0 with 8 allowed through a bunch of numbers that aren't on the original list.

e.g. changing 02071160299 to 82071160299 still appears to pass the regexp.




https://shkspr.mobi/blog/2021/05/the-74000-numbers-of-barcla... it's mentioned in another comment that indeed they forgot the anchors

The "correct" regex is 11KB and can be found here https://gist.github.com/jes/e678e4300d1cfcbcc12b46aaa7e58e30

I agree with another comment here that the 1.3MB JSON is a better solution though


I'm sure that this regex wasn't manually created. Is there a service or tool to create such regex?


Indeed, here is the source from the linked comment https://gist.github.com/jes/c7b848220bc36d8ae3771cd77f232d0c


You can go a long way by building a Trie and walking it to autogenerate a regex, although optimising it is a more complex challenge.


Probably the cardinal sin of regex: forgetting the anchors.

Also something really weird: when I view zimpenfish's comment in the post it shows as 54 minutes old which makes sense, when I click it to view direct or reply it shows as 2 days old which is really wonky. Any idea what is going on there? https://i.imgur.com/DvBDcIL.png


That's funny...

Might be something that got resubmitted from the second chance pool and then automatical rewrite only did half the work it should or something is cached or something similar?


AFAIK dang said that's intentional. The view on the thread gets faked to look consistent, but they don't want to modify the actual metadata of the comment you see in the direct view, and something is always going to be "wrong" however you do it.


Oooh, I bet you're right!




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: