Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [regex-group]

Regex groups are created by placing part of a regular expression inside parentheses. Groups allows to apply a quantifier to the entire group or to restrict alternation to part of the regex. Besides grouping part of a regular expression together, parentheses also create a numbered capturing group. It stores the part of the string matched by the part of the regular expression inside the parentheses.

-4 votes
0 answers
36 views

regex is failing in first char itself [closed]

^[^\s][\/s]*[A-Z0-9][A-Z0-9\.\,\:\;\/\-]*$ above is regex if i enter M it is failing or does not match. what changes i can make in above regex?
MP-SATARA's user avatar
0 votes
1 answer
45 views

python regex, how to unpack multiple group when group may not exit [closed]

# Code re_freq = re.compile(r'^(?P<num>\d+)?(?P<freq>\w)') for input in ['4S', '3W', 'S', 'W']: print(f'input: {input}:') num, freq = re_freq.search(input).group() print(f'. ...
Karun's user avatar
  • 629
0 votes
0 answers
28 views

How can I avoid returning a non-optional group that is undefined? [duplicate]

I've two possible strings: TEXT1, TEXT2\n\nTEXT3 TEXT1, TEXT2 Each text should be extracted without the comma and new line characters. I'm able to extract the first one with: const regex = /^\s*(.*),...
Julian's user avatar
  • 1,400
2 votes
2 answers
41 views

Regex match a string that is either seperated entirely by commas or seperated entirely by semicolons

What I'm trying to do is match a string of numbers that has a "consistent" separator between its contents. For example, I want is something that matches the following: [1,2,3,20,4] & [5;...
GabeDoubleU's user avatar
1 vote
1 answer
46 views

Using REG_MATCH and REG_REPLACE function in Informatica to replace a Prefix and suffix of a character

I have a Business requirement in infromatica where we have 2 set of Data's like 'HOUSE ACCOUNT - WELLS FARGO - I' where we have to remove the suffix ' - I ' and another Data 'JR INSURANCE BROKERAGE ...
karthik's user avatar
  • 239
0 votes
0 answers
17 views

Unable to print 2nd occurrence from rates [duplicate]

My sample text is pretty simple $56K - $86K (glass My regex is [0-9]+K which prints both 56K and 86K but I just want to print out 86K i.e. the 2nd time it matches the regex. I have tried the ...
Vik G's user avatar
  • 619
2 votes
3 answers
68 views

Regex: Find matches only outside of single quotes

I currently have a regex that selects all occurrences of (, , , );: (\s\()|(,\s)|(\),)|(\);) however, I've been trying to figure out a way so that if anything is between single quotes 'like this, for ...
RadicalRaccoon's user avatar
1 vote
2 answers
65 views

Matches the same two digits that were captured in the first group

select * from bha b where b.bks similar to '\d{2}[A-Z](\d{2})\d\\1'; The purpose is to regex but bks is in the form 12A56856 12A12812 12A898389 Although I already have this data in my database, ...
Nguyễn Tuấn Hưng's user avatar
1 vote
0 answers
18 views

Regex - lookahead and between [duplicate]

Suppose I have this structure of strings. I have >100k. 'xxxxxx0AxxZZxxBBxxxxx1AxxxxxBB' --Group1 is 1 'xxxxxxxxx0AxxxxZZxxxxx1AxxxxxBBxxxx' --Group1 is 1 '...
Henrik Løv's user avatar
0 votes
1 answer
67 views

Regex to find methods that have an 'inner' method

I'm working on some upkeep for a monolithic java codebase, where it was discovered that some of the @GET methods will actually start a write session, and should thus actually be @POST methods. I wrote ...
user9934848's user avatar
0 votes
1 answer
57 views

Why regex pattern is validated in some languages like Java, JavaScript but failed in Python and Regex101?

I have a regex pattern ^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}. It validated in Java and the Browser console but failed in Python. Various online regex testers produced different results. Regex101 displayed ...
Prabhjot Kaur's user avatar
-2 votes
1 answer
30 views

regular expression to find pattern in the same word [duplicate]

There is a string "123:987 767687:99 145:986 156:876 " My regex expression is (\d{3}):\1 I expecting the result is 123:987, 145:986, 156:876 there is no result found. i dont undertsand. ...
Анатолій's user avatar
6 votes
2 answers
63 views

Ignore string containing

Using PCRE2 regex for PHP script replacement The purpose of this regex is to add ?? '' to a strlen (PHP) function call if it does not currently exist. I plan to use a regex capture group to perform ...
w. Patrick Gale's user avatar
2 votes
1 answer
26 views

Regex search for pattern and return group

I have a text to search in like this: process ADT { { DOMAINNAME localdomain } { EODEFAULT {} } { EOXLATE {} } { XLATESTARTMODE 0 } } process ORU { { DOMAINNAME localdomain } {...
Tobias G.'s user avatar
  • 131
0 votes
1 answer
40 views

Regex pattern matching every url and not filtering

So I have the following urls from an app: 1.${endpoint}/list?currentPage=1&itemsPerPage=20&orderBy=name&orderType=1 2.${endpoint}/list?current=true&currentPage=1&itemsPerPage=20&...
Raul's user avatar
  • 3

15 30 50 per page
1
2 3 4 5
183