25 questions
0
votes
1
answer
309
views
Recursive Regex for Parsing SGF with JS
1. What SGF is
SGF is what's widely used to save Go (board game) games as text. In essence, it's basically the text encoding of something like a tree.
Here's an example of what it looks like — I ...
-1
votes
1
answer
123
views
JS Regex for Parsing SGF (Meta)data
SGF is what's widely used to save Go (board game) games as text. One example of how it saves its data is this — as a whole, SGF is a text-based representation of a trie, which means it is recursive, ...
0
votes
1
answer
45
views
Perl matching text using recursions spanning multiple lines
In the text below, I am trying to match \rem{lp}{some text with nested curly braces}. The regex101.com example works for the regex:
([^\s]*\s*)\\rem\{(?:lp|db)\}(\{((?>[^{}]|\n|(?2))*)\})(\s?[^\s]*)...
1
vote
1
answer
83
views
RegEx to capture a Pascal procedure's body
I'm trying to write a RegEx to capture a Pascal procedure's body. My biggest problem so far is capturing a procedure which has a nested procedure inside.
Test string:
Test
procedure A;
procedure B;...
-2
votes
2
answers
214
views
Regex - Recursion - nested matches with multiple ending
this is my first question on stackoverflow so please bare with me here. Also I am not a native english speaker.
(16.02.2022)
ANSWER (https://regex101.com/r/4FRznK/1 from Comment on Answer). Special ...
0
votes
0
answers
140
views
Recursive regex complexity
For a regex that support only +,?,*,.,|,[..],[^..],^,$,(..), a matcher that lets you match recursion: {<some-regex-name>} with length m, and a string of length n.
(the regex isn't supporting ...
0
votes
0
answers
87
views
How can I use SPARQL regex to parse Wikitext and extract values from parameters in a Wikimedia Commons template?
This query against the Wikidata SPARQL endpoint returns the Wikitext content of the first 50 files in the Wikimedia Commons category "1930s photographs in Auckland Museum". For each file, I ...
2
votes
2
answers
995
views
Regex: How can I catch big numbers with spaces in them?
I'm trying to catch all numbers from a string using Python regex. By numbers I mean integers and floats (using , or .).
I managed to get it done using this regex : ([0-9]+[\,|\.][0-9]+|[0-9]+)
But I ...
0
votes
2
answers
101
views
Regex for getting multiple words after a delimiter
I have been trying to get the separate groups from the below string using regex in PCRE:
drop = blah blah blah something keep = bar foo nlah aaaa rename = (a=b d=e) obs=4 where = (foo > 45 and bar =...
0
votes
2
answers
83
views
Match multiple strings in multi lines and also replace multiple strings
I want to replace all the strings with DISPLAY="TRUE" to DISPLAY="FALSE" in the first line and vice versa in the next line in a single match.
Example:
FROM:
<SYN DISPLAY="TRUE" SEARCH="TRUE" ...
1
vote
1
answer
72
views
Regex for matching text followed by text until closed bracket except matching opening bracket
Sorry if question is confusion.
From below text
value = ( select max( tbl.column_name ) from table tbl where trim(colum2)='value1'
and (trim((colum3)))='value3')
I want output below
select max( tbl....
0
votes
1
answer
1k
views
MySQL query to get count of repeating characters from a string
My target data/table:
mysql> select firstname from empl;
+-----------+
| firstname |
+-----------+
| Abhishek |
| Arnab |
| Aamaaan |
| Arbaaz |
| Mohon |
| Parikshit |
| Tom |
...
0
votes
1
answer
2k
views
Extracting number of specific length from a string in Postgres
I am trying to extract a set of numbers from comments like
"on april-17 transactions numbers are 12345 / 56789"
"on april-18 transactions numbers are 56789"
"on may-19 no transactions"
Which are ...
1
vote
1
answer
168
views
How can I use a recursive regex or another method to recursively validate this BBcode-like markup in Python?
I am attempting to write a program that validates documents written in a markup language similar to BBcode.
This markup language has both matching ([b]bold[/b] text) and non-matching (today is [date])...
3
votes
3
answers
313
views
How to get a group matched in a recursive regular expression?
I'm writing a simple regular expression that needs receive a pair of coordinates and/or a map name.
For example:
move 10 15 # should returns [[10, 15]]
move 10 15 map # should returns [[10, 15, 'map'...
1
vote
1
answer
1k
views
Don't understand where my "Unnecessary escape character" error comes from
I have a url that contains two values, a keyword and a location name. The keyword comes after the '/r/' and the location after the '/l/'.
E.g: localhost:3000/search/r/keyword/l/location
To get only ...
0
votes
1
answer
33
views
Get characters which are not in brackets REGEX
I'm basically working on custom query building. I've designed the pattern as field_set and sub_field_sets. A sample Query:
({e:3}.{f:44}.{f:2}) + (
({e:3}.{f:44}.{f:3}) + ({e:3}.{...
3
votes
1
answer
1k
views
Regex Recursion: Nth Subpatterns
I'm trying to learn about Recursion in Regular Expressions, and have a basic understanding of the concepts in the PCRE flavour. I want to break a string:
Geese (Flock) Dogs (Pack)
into:
Full Match:...
0
votes
0
answers
25
views
How to extract a list of all 18 character entries after specific phrase in string using RegExr?
I managed to extract a list of the text within square brackets within an emoji list I have here:
https://regexr.com/3sqk1
But now I need to extract the equivalent decimalSurrogateHtml pairs for each ...
2
votes
1
answer
58
views
Backreferences to other recursion levels in PHP / PCRE
I was trying to find the answer on the Net but I was not able to. Does the third section on this page applies to PHP / PCRE or not?
https://www.regular-expressions.info/recursebackref.html
the "...
3
votes
3
answers
432
views
Regex Expression to capture repeated patterns
I've been running around internet trying to find out how to build a regular expression to capture text in the way I need it; so I saw some StackOverflow questions but none of them express what I want, ...
6
votes
3
answers
671
views
Capturing text before and after a C-style code block with a Perl regular expression
I am trying to capture some text before and after a C-style code block using a Perl regular expression. So far this is what I have:
use strict;
use warnings;
my $text = << "END";
int max(int x,...
4
votes
2
answers
292
views
Why doesn't this recursive regex capture the entire code block?
I'm trying to write a recursive regular expression to capture code blocks, but for some reason it seems to not be capturing them properly. I would expect the code below to capture the full body of the ...
5
votes
2
answers
327
views
How exactly does this recursive regex work?
This is a followup to this question.
Have a look at this pattern:
(o(?1)?o)
It matches any sequence of o with a length of 2n, with n ≥ 1.
It works, see regex101.com (word boundaries added for better ...
1
vote
1
answer
96
views
Unexpected behavior around recursive regex
I am trying to match C++ argument type which can contain balanced <and > characters.
With this regex:
(\<(?>[^<>]|(?R))*\>)
On this string: QMap<QgsFeatureId, QPair<QMap&...