Questions tagged [re2]

RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, Python and Go. It is a C++ library.

RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, Python and Go. It is a C++ library, released under the BSD License.

Backtracking engines are typically full of features and convenient syntactic sugar but can be forced into taking exponential amounts of time on even small inputs. RE2 uses automata theory to guarantee that regular expression searches run in time linear in the size of the input. RE2 implements memory limits, so that searches can be constrained to a fixed amount of memory. RE2 is engineered to use a small fixed C++ stack footprint no matter what inputs or regular expressions it must process; thus RE2 is useful in multithreaded environments where thread stacks cannot grow arbitrarily large.

When RE2 was released, Russ Cox the main author of RE2, published a series of articles on the CS theory and real world implementation of regular expressions. Including some in depth benchmarks of RE2 vs competing regex libraries.

Bindings for some scripting languages languages exist for Python and Ruby.

Supported syntax can be found here.

382 questions
-2
votes
1 answer

RegEx to clean up and combine email campaigns in Google Data Studio

I'm pretty new to RegEx and am trying to create an expression to clean up some inconsistent email campaign naming so that I can report on them nicely in Google Data Studio. I have tried to self-assess by Googling and haven't had any luck. I'm…
jrode
  • 1
-2
votes
2 answers

Regex | CASE WHEN THEN ELSE "keep same value"

I am trying to group certain source/medium dimensions in Google Data Studio and leave the original value for the rest; for example: CASE WHEN (source/medium = “lnkd.IN|linkedin.*”) THEN “Linkedin” ELSE “” END Can the ELSE be blank to keep the…
-2
votes
1 answer

REGEXP with more than one condition in Google Data Studio?

I’m trying to categorize a custom field like this: CASE WHEN REGEXP_MATCH(Campaign, "BLU") THEN "Colour Blue" WHEN REGEXP_MATCH(Campaign, "GRE") THEN "Colour Green" WHEN REGEXP_MATCH(Campaign, "CAR") THEN "Product Car" WHEN…
brjoan
  • 11
  • 3
-3
votes
1 answer

negate string pattern using re2 regex also with match case

I'm using re2 regex to match and negate as in the this link Following are each possible inputs abcd-st-ed-qrew ktm-ewe-abcd-st-ed-qrew abcd-st-wer-qrew-wabe ktm-ewe-abcd-st-qrew-qrrt The conditions are: If string starts with abcd- then, it should…
CdVr
  • 323
  • 3
  • 15
-3
votes
1 answer

Regex Cleanup of Filename in Data Studio

I'm having some trouble with this as it requires multiple adjustments. I have a filename, for example: https://d820kax.cloudfront.net/wp-content/uploads/2019/12/Report-Name.pdf I want to: Trim all characters before the last slash; Remove the file…
-3
votes
1 answer

How to Extract a Custom URL Parameter in Google Data Studio?

I am trying to track performance of a URL parameter using Google Data Studio. The URL looks like this: https://example.com/?gclid=something&extension=me-trying-stuff I want to get me-trying-stuff at the end of &extension.
-3
votes
3 answers

Regex for strings not starting with "My" or "By"

I need Regex which matches when my string does not start with "MY" and "BY". I have tried something like: r = /^my&&^by/ but it doesn't work for me eg mycountry = false ; byyou = false ; xyz = true ;
Ashutosh Jha
  • 15,451
  • 11
  • 52
  • 85
1 2 3
25
26