TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How Regexes Work

73 pointsby aleyanover 2 years ago

4 comments

macintuxover 2 years ago
Probably taken from yesterday&#x27;s discussion: Ken Thompson&#x27;s NFA regex patent<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=33566557" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=33566557</a>
kqrover 2 years ago
Always a worthy, related mention: <a href="https:&#x2F;&#x2F;swtch.com&#x2F;~rsc&#x2F;regexp&#x2F;regexp1.html" rel="nofollow">https:&#x2F;&#x2F;swtch.com&#x2F;~rsc&#x2F;regexp&#x2F;regexp1.html</a><p>Another fun idea is the opposite of the regex: the regex constructs a state machine of the needle and is then quickly able to run many haystacks through it. Sometimes you need the other optimisation: compile the entire haystack down to a state machine, and you can run many needles through it! It becomes a very primitive search index.
评论 #33576028 未加载
评论 #33575972 未加载
评论 #33576138 未加载
ttulover 2 years ago
I worked briefly with Mark-Jason Dominus in 2000. He added instrumentation to the Perl regex engine so that we could develop a regex debugger for the forthcoming Komodo editor. Each time the engine advanced to process the next step, we would get a callback that included vital information such as the location in the regex string and the target string.<p>Today, there are numerous excellent tools like this on the web. Back in 2000, it was dark magic and so much fun to work on.
评论 #33576467 未加载
mNovakover 2 years ago
Curious if this exponentially slow regex is the reason Notepad++ crashes on loading modestly sized (10 MB) JSON?