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.

Regular Expression Matching Can Be Simple and Fast (2007)

73 pointsby prabhupantalmost 6 years ago

8 comments

fenivalmost 6 years ago
The author, Russ Cox, has a whole series of articles on the topic of regex - <a href="https:&#x2F;&#x2F;swtch.com&#x2F;~rsc&#x2F;regexp&#x2F;" rel="nofollow">https:&#x2F;&#x2F;swtch.com&#x2F;~rsc&#x2F;regexp&#x2F;</a><p>The rust Regex crate docs even refer to his posts as a reference since the rust version is based on his efficient RE2 Regex implementation at Google.
dangalmost 6 years ago
Threads from 2018: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16341519" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16341519</a><p>2015: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9374858" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9374858</a><p>2009: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=820201" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=820201</a><p>also 2009: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=466845" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=466845</a>
Quarrelalmost 6 years ago
But if you want faster, (but more complicated):<p><a href="https:&#x2F;&#x2F;github.com&#x2F;intel&#x2F;hyperscan" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;intel&#x2F;hyperscan</a>
评论 #20314948 未加载
DigitalTerminalalmost 6 years ago
Also relevant is Google V8&#x27;s Irregexp: <a href="https:&#x2F;&#x2F;blog.chromium.org&#x2F;2009&#x2F;02&#x2F;irregexp-google-chromes-new-regexp.html" rel="nofollow">https:&#x2F;&#x2F;blog.chromium.org&#x2F;2009&#x2F;02&#x2F;irregexp-google-chromes-ne...</a>. They claim 3x speedups.
评论 #20312539 未加载
pier25almost 6 years ago
A bit off topic, but here are some Regex benchmarks that might be of interest:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;mariomka&#x2F;regex-benchmark" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mariomka&#x2F;regex-benchmark</a><p>Surprisingly JS is about 10 times faster than Go.
评论 #20313531 未加载
yxhuvudalmost 6 years ago
What I wonder is if the regexps could be preprocessed in a way so that the fast variant is used for all or at least most cases where it it possible to use it.
abainbridgealmost 6 years ago
Is there any information about the performance when not looking for things like when a?a?a?aaa matches aaaaaa?
hyperpalliumalmost 6 years ago
Now you have an exponential space problem.
评论 #20312174 未加载
评论 #20313759 未加载
评论 #20311554 未加载
评论 #20311463 未加载