google/re2
View on GitHub ↗ ★ 9,842 C++
RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python. It is a C++ library.
51 mentions on Hacker News by 41 people: 7 stories, 44 comments · first 2015-06-04 · latest 2024-09-05
20082026
-
…) which parses the regex and instantiates the automaton entirely at compile-time, or Google's re2 ( https://github.com/google/re2 ) if you need to generate regular expressions at run-time. Even boost.regex on which std::regex is originally…
comment by jcelerier · 2024-09-05 · in Giving C++ std:regex a C makeover -
▲ 70
RE2 maintainer Paul Wankadia diedstory by danlark · 2024-07-08 · 11 comments
-
RE2 may beg to differ, if you care about performance. https://github.com/google/re2 Agreed on Larry Wall understanding the difference between linguistics and computer science, languages for humans to use vs languages for computers to use.
comment by lupire · 2024-07-06 · in What Happened to Perl 7? (2022) -
…guess if they used Google's re2 Regex library instead of Boost's, the result would be different. https://github.com/google/re2 https://github.com/greensoftwarelab/Energy-Languages/blob/ma...
comment by felixguendling · 2024-01-26 · in C Is the Greenest Programming Language -
Use re2 instead. It's nearly a drop-in replacement: https://github.com/google/re2 There are python bindings: https://pypi.org/project/google-re2/ I just had to point out a similar problem in a Swift project. I'd like to submit a PR to…
comment by js2 · 2023-09-09 · in Debugging catastrophic backtracking for regular expressions in Python -
…But with there are non-backtracking matchers which would make this O(n). Here's re2 from https://github.com/google/re2 : >>> import re2 >>> opts = re2.Options() >>> opts.max_mem = 200000000 >>> matcher = re2.compile(pattern, opts) >>>…
comment by eesmith · 2023-04-12 · in On a great interview question -
…"caching" approach documented in the Ruby bug ticket linked for quite some time (since its birth?): https://github.com/google/re2/blob/954656f47fe8fb505d4818da1... It is mentioned only briefly in Cox's article on regex matching in the…
comment by burntsushi · 2023-01-04 · in Ruby 3.2.0 is from another dimension -
…. (The second closest I've found in another repo is in RE2 from Mar 2010, https://github.com/google/re2/blame/954656f47fe8fb505d4818da... - and yes, both of these existed prior to the listed date, but I'm going off associated timest
comment by joatmon-snoo · 2022-12-14 · in Golink: A private shortlink service for tailnets -
See also: https://github.com/google/re2/blob/main/re2/bitstate.cc Although its space complexity is P*T, which limits its use to small regexes/haystacks. It sounds like your claim is that your technique achieves a smaller space bound?
comment by burntsushi · 2022-08-12 · in Rob Pike's simple C regex matcher in Go -
…if you use lookaheads, etc. The design philosophy behind RE2 for those unfamiliar with the library: https://github.com/google/re2/wiki/WhyRE2
comment by btown · 2022-06-10 · in Rulex – A new, portable, regular expression language -
…know, that would completely eliminate the possibility of catastrophic backtracking happening. [1]: https://github.com/google/re2
comment by ainar-g · 2022-04-07 · in Ruby 3.2 preview 1 with support for WASM compilation -
…strings that can be matched in a single pass through the text using only a fixed amount of memory. https://github.com/google/re2/wiki/Syntax Note that RE2 doesn't support backreferences.
comment by Thorrez · 2022-03-05 · in A regular expression to check for prime numbers (2007) -
▲ 48
RE2: iOS got rejected due to legal issue (Guideline 5.0 – Legal) Syriastory by lifthrasiir · 2022-02-10 · 8 comments
-
…performance comparisons to glibc, rust regex and cl-ppcre, but re2 was missing from that list. [1] https://github.com/google/re2
comment by froh · 2021-12-01 · in One-more-re-nightmare – A fast regex compiler in Common Lisp -
…intersection and complement though.[3] [1] - https://dl.acm.org/doi/10.1145/2071368.2071372 [2] - https://github.com/google/re2/issues/156#issuecomment-354068... [3] - https://github.com/google/redgrep
comment by burntsushi · 2021-01-01 · in State machines are wonderful tools -
▲ 1
RE2: A fast, thread-safe alternative to backtracking regular expression enginesstory by ogogmad · 2020-09-02 · 0 comments
-
…tool are based upon the knowledge found in Russ Cox's articles. Also, the link above on RE2: https://github.com/google/re2 is a project that was was also (started by|heavily contributed to by) Russ Cox. His writings on the topic of regular…
comment by robertelder · 2020-07-28 · in The Regular Expression Visualizer, Simulator and Cross-Compiler Tool -
…https://github.com/oilshell/blog-code/tree/master/regular-la... [1] https://github.com/google/re2 ---- Also, the production quality way of compiling regular expressions to C code looks like this [2], which is completely differ
comment by chubot · 2020-07-28 · in The Regular Expression Visualizer, Simulator and Cross-Compiler Tool -
Active repository, https://github.com/google/re2
comment by brudgers · 2020-05-19 · in RE2: A principled approach to regular expression matching (2011) -
…https://swtch.com/~rsc/regexp/regexp2.html And actual implementations based on these articles: https://github.com/google/re2 and https://github.com/rust-lang/regex
comment by kccqzy · 2020-05-02 · in Show HN: RegEx for Regular Folk – A visual, example-based introduction -
…about this a bit in part 3 of his articles on regex matching[1]. Its implementation in RE2 is here: https://github.com/google/re2/blob/master/re2/dfa.cc [1] - https://swtch.com/~rsc/regexp/regexp3.html
comment by burntsushi · 2020-03-15 · in The most surprising Unix programs -
The about blurb mentions it uses RE2. So backreferences aren't likely. See https://github.com/google/re2/issues/101
comment by tyingq · 2020-02-23 · in Show HN: Search code in GitHub repos using regular expressions -
…the Elisp reference manual: https://www.gnu.org/software/emacs/manual/html_node/elisp/Sy... . [1] https://github.com/google/re2/wiki/Syntax
comment by alexhutcheson · 2020-01-31 · in Show HN: Regex Cheatsheet -
▲ 1
RE2 regular expression syntax referencestory by shawndumas · 2019-08-05 · 0 comments
-
…But real progress would be removing dangerous backtracking regular expressions in favor of RE2: https://github.com/google/re2/wiki/Syntax
comment by jorangreef · 2019-07-30 · in What’s New in ES2019 -
…[3] https://cs.chromium.org/search/?q=DCHECK%5C(+case:yes&sq=pac... [4] https://github.com/google/re2/blob/master/util/logging.h [5] http://huonw.github.io/blog/2016/04/myths-and-legends-about-... [6] https://dxr.mozilla.org/mozil
comment by Buge · 2019-07-14 · in Report on the technical vulnerabilities found in Huawei 5G [pdf] -
Just to note Go Lang uses RE2 in its regexp[1]. [1]: https://github.com/google/re2/wiki/Syntax
comment by Abishek_Muthian · 2019-07-13 · in Details of the Cloudflare outage on July 2, 2019 -
…suffer this problem, but apparently they don't use it here? https://github.com/cloudflare/lua-re2 https://github.com/google/re2 https://github.com/google/re2/wiki/WhyRE2
comment by js2 · 2019-07-03 · in Cloudflare outage caused by bad software deploy -
You probably want a regex engine that runs in linear time: * Google's RE2 https://github.com/google/re2/wiki/WhyRE2 * https://github.com/laurikari/tre/ There is a good series of articles about the problem:…
comment by edwintorok · 2019-07-02 · in Cloudflare outage caused by bad software deploy -
…context, and it handles the DFA issue by simply putting an 8MB limit on the DFA for a regex: https://github.com/google/re2/blob/master/re2/re2.h#L601 I learned a few months ago that Rust's regex crate, which is based heavily on RE2, does…
comment by chubot · 2019-06-30 · in Regular Expression Matching Can Be Simple and Fast (2007) -
https://github.com/google/re2 is probably a better matched library by Google since the post focuses on truly regular expressions and a lot of irregexp's design is around making the irregular part not as costly.
comment by zamadatix · 2019-06-29 · in Regular Expression Matching Can Be Simple and Fast (2007) -
▲ 1
RE2: Safe RegExpstory by novaleaf · 2019-02-19 · 0 comments
-
…Random files from each of them: https://github.com/google/leveldb/blob/master/table/table_bu... https://github.com/google/re2/blob/master/re2/nfa.cc
comment by chubot · 2018-09-21 · in Ask HN: What open source project, in your opinion, has the highest code quality? -
…just use PCRE through the C++ wrapper[2], but that hasn't been a common need in my experience. [1] https://github.com/google/re2/ [2] https://www.pcre.org/original/doc/html/pcrecpp.html
comment by alexhutcheson · 2018-04-05 · in A meta-analysis of C++ projects -
Great observation, but re2 does have tradeoffs to gain that performance. Backreferences, for example: https://github.com/google/re2/issues/101
comment by tyingq · 2018-02-14 · in Speed improvements in Python 3.7 -
…tool that lets us confidently use complex regexes in production. https://pypi.python.org/pypi/re2/ https://github.com/google/re2/wiki/WhyRE2 > RE2 was designed and implemented with an explicit goal of being able to handle regular…
comment by btown · 2018-02-13 · in Speed improvements in Python 3.7 -
Here is the reference implementation for Russ Cox's work: https://github.com/google/re2
comment by erickj · 2017-12-05 · in Building a Regex Engine in Fewer Than 40 Lines of Code -
…rewrite that part of the code to not rely on constantly parsing file paths? Or use something like https://github.com/google/re2 , you probably won't be able to do any better than that when doing any kind of string matching and parsing. If…
comment by iamleppert · 2017-11-23 · in Improving Ruby Performance with Rust -
…match a given URL: https://github.com/nurettin/pwned/blob/master/server/server.... FilteredRE2 https://github.com/google/re2/blob/master/re2/filtered_re2.h
comment by nurettin · 2017-11-10 · in LibHTTP: Open Source HTTP Library in C -
guarantee worst-case linear time matching for any number of expressions Or you could just use RE2: https://github.com/google/re2/wiki/WhyRE2 It's open source, and match time is linear in the length of the input string. (Disclosure: I work…
comment by jefftk · 2016-12-09 · in Ask HN: What problem in your industry is a potential startup? -
Another good example is RE2: https://github.com/google/re2 It's pretty fast too. I don't know whether you can compare the performance of Ragel to regex libraries like RE2; they look like they solve different problems.
comment by tantalor · 2016-08-15 · in Tyre – Typed regular expressions -
▲ 2
RE2: A fast, safe, thread-friendly alternative to backtracking regexstory by scrollaway · 2016-07-20 · 0 comments
-
Is this the sort of thing that https://github.com/google/re2 was made to solve?
comment by selckin · 2016-07-20 · in Stack Overflow Outage Postmortem -
…pretty standard example: https://en.wikipedia.org/wiki/Regular_expression#Expressive_... See also: https://github.com/google/re2/blob/master/re2/testing/dfa_te... This blurb from Wikipedia is also relevant: > On the other hand, it is known…
comment by burntsushi · 2016-02-24 · in LL and LR in Context: Why Parsing Tools Are Hard (2013) -
…is using it though, but a library called "re2". Never heard of it before. Googling turned up this https://github.com/google/re2
comment by petke · 2016-01-12 · in Two Weeks of Rust -
https://github.com/google/re2/blob/master/re2/set.h <-- c++ API https://github.com/google/re2/blob/master/re2/prog.h#L339 <-- c
comment by willvarfar · 2015-11-20 · in Python's Hidden Regular Expression Gems -
…fit for you, but it's not strictly true that RE2 can't tell you about multi-pattern matching. https://github.com/google/re2/blob/master/re2/set.h
comment by rsc · 2015-10-21 · in Hyperscan, a high-performance multiple regex matching library -
…falls over flat[1]. EDIT: Looks like the original linked page was first published in 2001[2]. [0] https://github.com/google/re2 [1] https://swtch.com/~rsc/regexp/regexp1.html [2] https://web.archive.org/web/*/http://perl.plover.com/NPC/
comment by kyrra · 2015-09-15 · in Perl Regular Expression Matching Is NP-Hard -
Google has a similar library with similar goals. See https://github.com/google/re2/wiki/CplusplusAPI It also removes backtracking. The idea is that backtracking may kill performance, so a specially crafted text that causes a lot of…
comment by nine_k · 2015-09-13 · in Perl Incompatible Regular Expressions -
▲ 1
RE2 Regex Syntaxstory by eatonphil · 2015-09-10 · 0 comments