Work in progress: 82,651 of 181,233 sites checked so far, more every week · updated 2 Nov 2026Missing a blog? Tell us

Top all-time · #110

S

swtchboard

Personal blog · swtch.comprogrammingsystems

swtchboard is a personal blog at swtch.com about programming and systems. Since 2007, 356 different Hacker News readers have linked it 534 times, most often “Regular Expression Matching Can Be Simple and Fast (2007)”. No feed was found, so read it on the site itself.

No feed foundVisit the blog
534mentions?
8recommend?
356HN people?
2007–2026first – last linked?
Links on Hacker News per year · peak 45 in 2013

Sometimes recommended · 8 of 40 sampled comments recommend it?

Why HN links it

HN readers link Russ Cox's regular-expression articles on swtch.com to explain NFA matching, backtracking and RE2. Commenters call them very well written and easy to understand.

Recommended for · 8 comments
'very well written', 'easy to understand', 'pretty indispensable', 'good pictures', 'worth a read', 'a great example of using pointers in C'

Summarised by Claude from a sample of 40 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.

Most-linked posts?

  1. Regular Expression Matching Can Be Simple and Fast (2007)
    91 people · 109 mentions · first linked 2015-04-14
  2. Regular Expression Matching Can Be Simple And Fast
    56 people · 60 mentions · first linked 2008-01-22
  3. Implementing Regular Expressions (2007)
    32 people · 38 mentions · first linked 2015-06-08
  4. How Google Code Search Worked: Regex Matching with a Trigram Index (2012)
    32 people · 32 mentions · first linked 2015-05-22
  5. Plan 9 from User Space
    23 people · 33 mentions · first linked 2009-05-05
  6. Regular Expression Matching: The Virtual Machine Approach (2009)
    18 people · 19 mentions · first linked 2016-02-20
  7. Implementing Regular Expressions
    16 people · 16 mentions · first linked 2010-08-23
  8. How Google Code Search Worked
    13 people · 14 mentions · first linked 2012-01-19
  9. Bell Labs and CSP Threads
    12 people · 20 mentions · first linked 2007-11-05
  10. Libtask: a Coroutine Library for C and Unix
    9 people · 11 mentions · first linked 2009-06-27

What Hacker News says?

  1. > What is currently still not feasible is to create a custom git repository whose HEAD matches that of the Linux kernel. I'm not convinced that's good enough. In git, the SHA1 is always the hash of a gzip, which is subject to tricks[1] where a header might be prepared and then some padding inserted to collide a malicious tail. [1]: http://swtch.com/r.zip

    Comment linking /r.zip

    on “Announcing the first SHA-1 collision”
  2. Submitted How Google Code Search Worked: Regex Matching with a Trigram Index (2012) as a story · 434 points

    HN discussion
  3. Thanks for these tips -- I've seen your visualizations and it's nice to hear from people who have done it! It's cool that you were able to reproduce the diagram quickly and in a small amount of code. It looks a bit foreign to me, probably because I don't know much about SVG (or canvas for that matter). And as I understand it Observable is almost another language on top. (I do know HTML, CSS, and JS pretty well, but…

    Comment linking /~rsc/regexp/regexp1.html

    on “Gears”
  4. Submitted How Google Code Search Worked as a story · 287 points

    HN discussion
  5. For anybody who's lost: Russ Cox is the original author of re2, a fast C++ library implementing regular expressions that are guaranteed to run in linear-time. There's a collection of articles they wrote talking about regexes and various pitfalls: https://swtch.com/~rsc/regexp/

    Comment linking /~rsc/regexp/

    on “An Unbelievable Demo”
  6. Submitted How Google Code Search Worked (2012) as a story · 168 points

    HN discussion
  7. Yes, I recall that he talks about the multi-engine approach with respect to both PCRE and RE2 somewhere in these articles: https://swtch.com/~rsc/regexp/ Sorry I don't have the exact reference handy. Apparently the author of PCRE tried to implement an NFA/DFA engine for some regexes as well. And I think RE2 might also have different strategies for different regexes as well, but I forget the details (it might be rela…

    Comment linking /~rsc/regexp/

    on “Stack Overflow Outage Postmortem”
  8. Submitted Regular expression matching can be simple and fast (2007) as a story · 141 points

    HN discussion
  9. chubot · 2016-07-20Recommends
    Admittedly I haven't stepped through all the code, but it's 958 lines and doesn't look horrible. It somewhat resembles the example C programs here: https://swtch.com/~rsc/regexp/ In particular there don't seem to be crazy optimizations and non-portable stuff like you see in other production regex implementations and in interpreters. It's pure ANSI C. The functions are all short -- no 1000 line monsters like I've see…

    Comment linking /~rsc/regexp/

    on “Stack Overflow Outage Postmortem”
  10. Submitted Regular Expression Matching with a Trigram Index (2012) as a story · 96 points

    HN discussion
  11. Experienced something similar myself. Was even thinking about creating regular expression library which just allow "safe" and fast expression. The trick would be to not allow only expression that can be translated easily to state automate. Good regex: "Phone number [0-9]* " Bad regex: ";Name=. ;" as . can also match ";" and it can lead to bad backtracking. You should rewrite this regex to ";Name=[^;] ;" RE2 is proba…

    Comment linking /~rsc/regexp/regexp1.html

    on “Stack Overflow Outage Postmortem”
  12. Submitted Regular Expression Matching Can Be Simple And Fast as a story · 95 points

    HN discussion
  13. Ha! The same bug happened internally at my company. In that case it was a regex matching a URL taking so much CPU as to cause a DOS of a proxy server. I won't be surprised if it's happened to someone here too. This is very timely, because minutes ago, I made a link to Russ Cox's articles in my Kernighan awk repo: https://github.com/andychu/bwk https://swtch.com/~rsc/regexp/regexp1.html If you are not familiar with t…

    Comment linking /~rsc/regexp/regexp1.html

    on “Stack Overflow Outage Postmortem”
  14. Submitted Why threads vs events is a nonsensical question. as a story · 92 points

    HN discussion
  15. re2 is described here: http://swtch.com/~rsc/regexp/regexp3.html

    Comment linking /~rsc/regexp/regexp3.html

    on “Node.js in Flame Graphs”
  16. Submitted Regular Expression Matching Can Be Simple and Fast (2007) as a story · 78 points

    HN discussion
  17. I agree with this ... I coded a Thompson NFA [1] out of interest a few years ago; definitely recommended as an exercise. [1] https://swtch.com/~rsc/regexp/regexp1.html

    Comment linking /~rsc/regexp/regexp1.html

    on “More challenging projects every programmer should try”
  18. Submitted Regular Expression Matching Can Be Simple and Fast (2007) as a story · 73 points

    HN discussion
  19. KMag · 2020-12-21Recommends
    Have a look at RE2 and Russ Cox's paper [0]. I found it particularly elegant the use of a small LRU cache to effectively lazily convert portions of the NFA to a DFA. A fast regex engine is pretty easy to implement, as long as you don't need extensions, particularly backreferences. [0] https://swtch.com/~rsc/regexp/regexp1.html

    Comment linking /~rsc/regexp/regexp1.html

    on “More challenging projects every programmer should try”
  20. Submitted Regular Expression Matching in the Wild as a story · 68 points

    HN discussion
  21. Yes, I certainly benefitted very much from the series. Here is the first episode - devastating, convincing, easy to understand and very well written: https://swtch.com/~rsc/regexp/regexp1.html

    Comment linking /~rsc/regexp/regexp1.html

    on “Russ Cox is stepping down as the Go tech lead”
  22. Submitted 9vx: a port of the Plan 9 operating system to FreeBSD, Linux, and OS X as a story · 64 points

    HN discussion
  23. maxmcd · 2024-08-01Recommends
    Agreed, see the index of those posts: https://research.swtch.com/vgo Other contenders I find myself sharing and re-reading: - https://swtch.com/~rsc/regexp/regexp1.html - https://swtch.com/~rsc/regexp/regexp4.html - https://research.swtch.com/bisect - https://research.swtch.com/zip

    Comment linking /~rsc/regexp/regexp4.html

    on “Russ Cox is stepping down as the Go tech lead”
  24. Submitted Regular Expression Matching: the Virtual Machine Approach as a story · 53 points

    HN discussion
  25. One thing that was interesting to me: The outage was caused by a regex that ended up doing a lot of backtracking, which caused PCRE, the regex engine, to essentially handle a runaway expression. This reminded me of a HN post from a couple months back by the author of Google Code Search, and how it worked: https://swtch.com/~rsc/regexp/regexp4.html . Interestingly, he wrote his own regex engine, RE2, specifically bec…

    Comment linking /~rsc/regexp/regexp4.html

    on “Details of the Cloudflare outage on July 2, 2019”
  26. Submitted Regular Expression Matching: The Virtual Machine Approach (2009) as a story · 49 points

    HN discussion
  27. Russ Cox also wrote RE2: https://swtch.com/~rsc/regexp/

    Comment linking /~rsc/regexp/

    on “Details of the Cloudflare outage on July 2, 2019”
  28. Submitted Semaphores in Plan 9 [pdf] as a story · 49 points

    HN discussion
  29. Note: Golang's stdlib regexp ( https://golang.org/pkg/regexp/ ) is guaranteed to run in time linear to the size of input. Russ Cox has a detailed article https://swtch.com/~rsc/regexp/regexp1.html

    Comment linking /~rsc/regexp/regexp1.html

    on “Details of the Cloudflare outage on July 2, 2019”
  30. Submitted Implementing Regular Expressions as a story · 48 points

    HN discussion

Search all of HN for swtch.com

Linked by the same people?