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
-1
votes
2 answers

How to extract substrings

I wrote in Go the following code to extract two values ​​inside the string. I used two regexp to seek the numbers (float64). The first result is the correct, only de number. But the second is wrong. This is the code: package main import ( …
Jumanyi
  • 375
  • 1
  • 2
  • 9
-1
votes
2 answers

What is the right regex for extracting string after first symbol?

In google data studio I would like to make a REGEXP_EXTRACT for getting the string after the first | symbol (https://regex101.com/r/w3BqW4/2). I've tried the regex: [|].*?$ but this is returning: ' | Leren afzaklaarzen Elisio | kalk' So I still…
Sam
  • 13
  • 2
-1
votes
3 answers

How can I use regular expressions to capture a price?

I'm trying to isolate for $198 using regular expressions. I have a function on Google Sheets that searches URLs and the HTML using regular expressions and so far I've been successful isolating different information from the page, but I can't isolate…
matufling
  • 7
  • 1
-1
votes
1 answer

How to write a complex calculated field in Data Studio with regex?

I have been trying to make this regular expression REGEX filter work in Google Data Studio. It is supposed to do the following Check the field "src_id" and COUNT all the values containing "widget". Check the field "Page" and COUNT all the values…
Smith O.
  • 217
  • 4
  • 16
-1
votes
1 answer

Extract text from Google Sheets using REGEXExtract

I'm trying to extract the company name from these text strings in Google Sheets. However, I can't get my head wrapped around regular expressions and regexextract. Strings: S-1 - Wealthbridge Acquisition Ltd (0001753673) (Filer) S-1/A - KinerjaPay…
-1
votes
1 answer

Can't count cells populated by a RegExMatch function

I am attempting to count the sum of a column populated by a RegExMatch function but using a COUNT function, eg =COUNT(F2:F100). The function that populates a cell with '1' is: =IF(RegExMatch($E2,"SKU123"),"1","") I can see '1' appear many times in…
-1
votes
1 answer

How can i use multi match in re2 regex for terraform

How can we do a multi match in re2? below is the url i want to apply regex on https://c43545332542.us-east-1.amazonaws.com/new_stage below is my code value = "${replace(aws_api_gateway_deployment.deployment.invoke_url,"/(?i)https:///","")}" I am…
Shane Warne
  • 1,350
  • 11
  • 24
-1
votes
1 answer

Google Spreadsheet RE2 Regex and Geojson

I have a Geojson in a google sheet cell. I'd like to extract coordinates from that. I tried using Regexextract function but I'm really having trouble in making the regex work. This is a sample structure: { "type": "FeatureCollection", …
Gusepo
  • 837
  • 2
  • 13
  • 26
-1
votes
1 answer

What RegEx code do I need to leave something as-is

I have a list of page names such as below: Homepage Product 1 Accounts Sign In Product 2 Campaign Product 3 I want to use a calculated field in Google Data Studio to aggregate all Product pages. How would I write the code so that it still…
jacob
  • 1
-1
votes
1 answer

Extracting a numeric string from URL

I was trying to extract this numeric string: 232546102069 from the given link: http://www.abc.in/itm/fawf-asdfsafjsaf-jasfh-lbadfugo-hasdhf-asdijfh-xpq/232546102069?hash=item3624d3eb35:g:BU4AAOSwm3pZ-cQV using regex in Sheets. Can anyone help me…
-1
votes
1 answer

RegexMatch Returns 'False', but Regex String Looks Correct

I'm attempting to match common email domains--but not company domains--in an email list, and I'm trying to use RegexMatch in Google Sheets (the regexmatch is part of a larger IF formula, but this part specifically isn't working). Obviously, I'm…
James
  • 57
  • 1
  • 1
  • 7
-2
votes
2 answers

How to use RegEx to get part of redirect url?

I have a column with list redirect URL on Google Custom Search Results. I would like to extract the external domain from that combined…
p.in4matics
  • 97
  • 1
  • 9
-2
votes
1 answer

re2: extracting multiple fields between paired delimiters

I have a log file. Each line (or record) in the log file retains the following format: tsB{{2020-08-18 15:02:29,793}}tsE,fnB{{standard_task_runner.py}}fnE,lnB{{53}}lnE,lvlB{{INFO}}lvlE Here is what I want to do: 1] Extract 2020-08-18 15:02:29,793…
nate
  • 440
  • 2
  • 8
  • 18
-2
votes
2 answers

regex allow white space, but do not begin or end with one, and not all white spaces

I am trying to implement a regex rule that would allow users to enter white spaces, but it should not be all white spaces, nor begin or end with a white space. My research did not yield any workable solution. Currently, my rule looks like this, and…
Yugue Chen
  • 79
  • 5
-2
votes
1 answer

Exclude pattern in RegExp match Golang

I need to extract a part of a string in Golang for a dashboard in Google Data Studio. This is the string: ABC - What I need::Other Information I do not need To get the part between the hyphen and the first colon I have tried ([\\-].*[\\:]), which…
pscl
  • 15
  • 1
  • 4
1 2 3
25
26