223 questions
2
votes
3
answers
150
views
SQL capturing group: prioritizing possible?
Is it possible to order or prioritize something in a capturing group? Like this:
SELECT * IN table WHERE name = "(f|o|d)(b|a|z).*" ORDER BY ?;
so the result is ordered by the order of the ...
1
vote
0
answers
29
views
R: how to replace string with digit after capturing group [duplicate]
I need to transform strings like 333bis into 33300, so I set up a regex pattern like (\d{3})(bis), but I can't use \100 as substitute pattern, because it will be interpreted as "group 100". ...
0
votes
1
answer
88
views
replace pattern in lines with data find in another file with sed in BASH
I have 2 files: a channellist file and a global source file containing data of all channels.
In the channellist there are f.i. these 2 lines; of course there are a lot more and all lines are starting ...
-1
votes
3
answers
85
views
How can I achieve this regex without a look ahead assertion?
I have regex which uses a look ahead assertion to match strings of the format {{ x }}. The regex is /(?<=\{\{\s)[^}\s]+(?=\s*\}\})/gm
How can I achieve this without using a look ahead assertion?
1
vote
2
answers
86
views
Regex conditional non-capturing group
I am trying to extract the email`s username if the email is from a specific domain. otherwise, get the full email. I need the result to be set in Group 1.
[email protected] => test
test@example2....
0
votes
1
answer
32
views
None capturing groups in regex not working as expected
The following match patter does look for the character / not having a blank space before it, but having a blank or a dot or a line ending after it.
>>> import re
>>> re.search(r"...
6
votes
2
answers
325
views
Regex that match exactly 3 identical consecutive numbers
Good morning all,
I want to make a regex that match 3 same consecutive numbers. It should match only 3 numbers in a row (separated by a space), the numbers should be identical. If there are less or ...
1
vote
1
answer
52
views
Extracting an optional project name in a fully optional pattern
I have this string "https://url/projects/x/flow/" and i want:
if projects is existing in the string, capture x in a group named project_name
if projects not existing in the string, then ...
2
votes
1
answer
53
views
allMatches not matching several groups exactly
I thought I knew about regex... Here's the situation:
N-U0 U0-M1
M1-T9 T9-R10 R10-E19
E19-L100 L100-B
I have a String that contains groups (let's call them transitions) separated by whitespace (may or ...
0
votes
2
answers
84
views
Regular Expressions in Javascript - Find Multiple Lines of Text After a Tag
I have the text below stored in the variable description:
This is a code update
Official Name: None
Pub: https://content.upcodes.co/viewer/washington/wa-mechanical-code-2021
Agency:
Reference: ...
1
vote
2
answers
110
views
Regex: Only the first match of word after a given word is returned
I have a test string
"apple search from here apple, banana, apple."
and the following RegEx
(?i)(?<=search from here\s)(\bapple|banana|orange\b)(\s+(\bapple|banana|orange\b))*
I'm getting ...
1
vote
3
answers
178
views
Conditional matching complex regex in capturing group
I am writing a regex for my git commit-msg hook and can't deal with the last part.
This is my regex
/^GRP\-[0-9]+\s(FIX|CHANGE|HOTFIX|FEATURE){1}\s(CORE|SHARED|ADM|CSR|BUS|OTHER){1}\s-\s.+/
My commit ...
1
vote
1
answer
66
views
How do I fix my capturing groups to capture parts of a string of numbers?
As a new programmer, I am working on a problem that tells me to turn an array of 10 ints into a formatted string phone number that looks like this: (999) 999-9999. I am getting an error/issue with ...
2
votes
2
answers
75
views
Javascript Regex capture group with at least 1 non-digit of two forms: delimited by space and enclosed in quotes
I'm trying to category_id for purely numeric values, this works. I need to also capture category_name. For category_name, I need to capture until space or include space if it started with a double ...
5
votes
3
answers
430
views
In Perl, is there a limit to the number of capture groups in a Regular Expression?
Is there a limit to the number of capture groups in a regular expression? I used to think it was 9 ($1 ... $9), but haven't found anything in the perlre docs to confirm this. And in fact, the ...