Linked Questions

-2 votes
2 answers
654 views

regex - non-capturing group returns the supposedly non-captured group,,? [duplicate]

This is not a duplicate.. in my belief. I'm not asking about its usefulness. I ask for clarification of definition, if I may. Instead of downvoting, kindly, explain. Then I'll remove this post if I ...
dia's user avatar
  • 431
1 vote
2 answers
381 views

RegEx: Capturing all individual instances of a repeating capture group [duplicate]

I have a string that could be formatted in the following ways: user-style-1 user-style-1-bold user-style-1-italic user-style-1-bold-italic I'm attempting to capture (respectively): nothing (does ...
Ben Black's user avatar
  • 3,760
0 votes
1 answer
99 views

How do you get all matches in a repeated backreference? [duplicate]

With the test string: This is a string1 string2 string3 string4 string5 string6 string7 so it is. Is it possible to get all the stringXs as backreferences? Currently what I've tried ends up ...
LeonardChallis's user avatar
0 votes
0 answers
121 views

Regex: Repeat captured group [duplicate]

For the following generated HTML <a href="http://google.com">google.com</a> Static text <a href="http://Bing.com">bing.com</a> <a href="http://google.com">google.com<...
JasperJ's user avatar
  • 1,222
0 votes
1 answer
115 views

Regex only matches last part of date in match group 1 [duplicate]

I have the following string: 22/04/2020 14:10 by [email protected] And I wrote the following regex: ^(\d{2,4}\/?)+ Why does group 1 only match the last part of the date and not the whole date, ...
Drago's user avatar
  • 1,845
1 vote
1 answer
84 views

Why isn't this repeated inner group matching in regex? [duplicate]

I'm trying to parse the following LaTeX string: \graphicspath{ {outputs/tikz/turnover/} {outputs/tikz/health/} {outputs/tikz/flows/} {outputs/model/figs/compare/} {outputs/model/figs/...
jessexknight's user avatar
-1 votes
1 answer
78 views

Explanation in REGEXP_REPLACE function output [duplicate]

Following two query gives some output, Select REGEXP_REPLACE('Milind,Milind,Gopal,Gopal,Gopal,Milind'), '([^,]+) (,\1)+(,|$)', '\1\3') "OUTPUT" FROM dual; o/p Milind,Gopal,Milind Select ...
Say_milli's user avatar
-1 votes
1 answer
55 views

It's possible to match all ocurrences of a pattern inside string, with a given start and end? [duplicate]

I need to get first="john" second="doe" and firstz="johnz" secondz="doez" from this text: any text here [link first="john" second="doe"] anytexthere [link firstz="johnz" secondz="doez"] The ...
Emanuel's user avatar
  • 3,153
0 votes
0 answers
51 views

capturing non repeating and repeating groups using a single regex [duplicate]

Test site used : https://regex101.com/ Sample text Tag [key=AccountAlias, value=MyAccount, tagDefinition=default-tag-definition] RegEx 0 ( Non repeating ) (\w+) \[(.*)\] Captures Group 1. 0-...
sharadendu sinha's user avatar
-1 votes
1 answer
44 views

postgres regexp pattern unexpected results [duplicate]

Using in Postgres the code select regexp_matches('02417 02444 02442 ','^(\d{5})\s{1,}(:?(\d{5})\s{1,})*','g'); yields {'02417','02442 ','02442'} while I was expecting {'02417','02444','02442'} What ...
George Kourtis's user avatar
0 votes
0 answers
24 views

regex: how to get repeating blocks as groups()? [duplicate]

Assume that we have a string such as '{ CAN_READ, CAN_WRITE }' and '{ CAN_READ, CAN_WRITE, CAN_REMOVE }' and want to extract the elements (CAN_READ, CAN_WRITE, CAN_REMOVE). We assume that the number ...
Akihiko's user avatar
  • 372
0 votes
0 answers
22 views

What regex to split a dot delimited string into arbitrary number of capture groups [duplicate]

I would like to separate a dot delimited string into its component parts using regex. I can build something that captures the first example, but struggling to find out how to get the pattern to ...
JCOGS Design's user avatar
0 votes
0 answers
16 views

How to write a Ruby script that extracts IPs from a NMAP scan [duplicate]

I'm trying to write a script in Ruby that extracts some IP and different informations from a NMAP scan output. I'm using regular expressions and I already know how to properly extract IPs but there's ...
Mr.Laf's user avatar
  • 17
0 votes
0 answers
13 views

Strange regex behaviour, captures too greedy in complete regex, but correctly when tested alone [duplicate]

I have this regex to extract reference information from a document: (?=(((Ard.|Lorr.) *?:|;) *([^;:]{0,100}) (\([0-9/, -]{0,10}/[0-9/, -]{0,10}\)), *([^;]{0,250}?),* *(([0-3]?[0-9]\.)?[01]?[0-9]\.[0-...
charelf's user avatar
  • 3,659
234 votes
16 answers
194k views

Swift extract regex matches

I want to extract substrings from a string that match a regex pattern. So I'm looking for something like this: func matchesForRegexInText(regex: String!, text: String!) -> [String] { ??? } ...
mitchkman's user avatar
  • 6,570

15 30 50 per page