Questions tagged [regex-lookarounds]
Regular expression lookarounds are zero-width assertions that verify conditions about the context of a match at the current match position.
regex-lookarounds
3,325
questions
-4
votes
0
answers
34
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?
-2
votes
0
answers
23
views
Positive Lookbehind with multiple matches [duplicate]
Assume the following input:
mmmmmm (A 123, 345 bbbb; 234, 456 ccc) nnnnn (345, 567; 456, 678).
I'm interested in both number groups 123, 345 and 234, 456. "A" is fixed. It's easy to search ...
1
vote
1
answer
52
views
Regex: split string into sets of chars from a pool
Is there a way to describe a regex splitting a string into sets of chars from a limited pool without duplications? For example we have pool of chars (A, B, and C), so string "AABABCCAB" gets ...
-2
votes
0
answers
36
views
Regex look behind with repeated characters [duplicate]
How can I put [\r\n\t]* into a regex look behind?
If I have some text like:
"My name is
XXX"
and I want to match the "XXX" but the between "is" and "XXX" ...
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 ...
2
votes
3
answers
67
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 ...
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
'...
2
votes
3
answers
156
views
Regex to prevent certain ranges
I have currently the following regex
ZL[^0-9].{16}_.{3}PAD_N.{26}\.PIC
which matches filenames like
ZLF_1177_0771428479_534PAD_N0530130SALP09217_1100LMV01.PIC
but would like to change the regex so ...
-1
votes
1
answer
36
views
Snakemake wildcard constraint using negative lookbehind or lookahead
I'm building a snakemake pipeline to align some NGS data, and some of the samples are single end and others are paired end, which require slightly different analyses. My solution was to declare a ...
1
vote
0
answers
17
views
Regex match a character a maximum of one time in entire string [duplicate]
I'm looking at URLs and am trying to verify that the ? and # characters are not repeated more than once across the entire string. Browsers will still render the URL, but it's poorly interpreted by ...
2
votes
1
answer
63
views
RegEx to exclude two strings without negative lookahead
I need to exclude any file that has name BUILD.bazel or WORKSPACE.bazel (case sensitive). I cannot use negative lookahead as Go regex does not support negative lookahead. I have this.
I tried without ...
1
vote
1
answer
46
views
Capture text block(s) starting with specific header and containing keyword(s)
I am trying to capture text blocks which start with the header Sender: or From: and contain the keyword SOA.
Original text
Sender:
John Doe
This is an email about Service-Oriented Architecture (...
1
vote
1
answer
41
views
Presto SQL-Extract sting from the last occurence of char (:) from the right
My goal is to get all the substrings after the last occurene of the char hypen from the right in each string separated by hypen. Ive tried, but i'm getting wrong values if there are multiple "...
2
votes
2
answers
56
views
How to limit lookbehind to strings which do not start with certain characters
In InDesign, I’m using the GREP expression (?<=.)/(?=.) to locate all occurrences of the slash character / throughout a document.
For example, I want to find the character / in Color/Colour or ...
1
vote
0
answers
43
views
A working RegEx match that begins at the first of two OR-words takes the unwanted last OR-word instead if I place more RegEx before it [duplicate]
For this String:
SELECT a, bc d AS Error FROM y WHERE 1=1 HAVING 1=1
I need to get two matching groups:
bc d as the code that builds the column called "Error". This is dummy code, do not ...