Submission timeline
2007–2026One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.
First comments on top threads
HN comment orderI have a re.c file in my best-of collection of code examples locally - but I can't seem to find the original source quickly - nevertheless it was written by Russ Cox[0] and he's spent a lot of time making regular expressions accessible and elegant, his articles are a great resource. [0] https://swtch.com/~rsc/regexp/
Can someone explain to me why the matchstar function takes its first param as an integer? to me it should be a char. int matchstar(int c, char *regexp, char *text) { do { /* a * matches zero or more instances */ if (matchhere(regexp, text)) return 1; } while (*text != '\0' && (*text++ == c || c == '.')); return 0; }
It's very nice pattern-matching code, but it isn't a regular expression matcher. The class of patterns it's able to match is much smaller than the class of all regular expressions -- not because of missing "sugar" (character classes, +, non-greedy wildcards, ...) but because it doesn't support groups or the | operator. As a result, the language supported by this matcher has, e.g., no way to match the pattern (ab)* or the pattern a|b. It's much, much less powerful than…
"[star] matches zero or more occurrences of the previous character" …those aren't regular expressions. Those are fancy globs. Regular expressions have a formal definition that is strictly more expressive than that. They mention they use recursion (which you can use to actually implement regular expressions, albeit poorly) but… …they use the recursion as a way of implementing a state machine in C? You can get away with this (and it's somewhat common) in a language like Lisp or ML that…
The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.
- Breakout years
- 2
- Total points
- 507
- Total comments
- 137
100+ points or 50+ comments
reference only — not used in Hall rules or ranking
reference only — not used in Hall rules or ranking
Every submission
| Date | Title as submitted | By | Points | Comments |
|---|---|---|---|---|
| 2011-07-03 | A Regular Expression Matcher in 30 lines of C | coderdude | 63 | 9 |
| 2012-04-11 | A [beautiful] Regular Expression Matcher | wickedchicken | 4 | 0 |
| 2013-05-08 | A regular expression matcher By Rob Pike and Brian Kernighan (2007) | sid6376 | 96 | 45 |
| 2015-12-01 | A Regular Expression Matcher (2007) | sagargv | 12 | 1 |
| 2016-08-01 | A Regular Expression Matcher (2007)First breakout · Best thread | _acme | 132 | 34 |
| 2018-02-09 | A Regular Expression Matcher | shakkhar | 2 | 0 |
| 2020-02-13 | A Regular Expression Matcher (2007) | ville | 109 | 22 |
| 2022-03-26 | A Regular Expression Matcher by Rob Pike | wazbug | 2 | 0 |
| 2022-08-25 | A Regular Expression Matcher (2007)Latest 20+ point return | synergy20 | 85 | 25 |
| 2024-05-23 | A Regular Expression Matcher (2007) | aragonite | 2 | 1 |
