Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Regular expressions can blow up (lemire.me)
2 points by SerCe on Jan 25, 2025 | hide | past | favorite | 2 comments


Comp Sci professor discovers the "garbage in, garbage out" principle. Also demonstrates the common practice of running code you don't understand. An opportunity to illustrate and explain the power and pitfalls of regular expressions, squandered on a terrible example.

This innocent-looking C++ code gets through the compiler and runs for even longer than 7 minutes:

  while (1) {
      ...
  }
My car "accepts" any random liquid I can't identify poured into the gas tank, but then doesn't work.


"Don't be snarky."

"Please respond to the strongest plausible interpretation of what someone says, not a weaker one that's easier to criticize. Assume good faith."

https://news.ycombinator.com/newsguidelines.html




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

Search: