regex-lookarounds Questions

3

Solved

I'm trying to do a negative lookahead on an elasticsearch query, the regex is: (?!.*charge)(?!.*encode)(?!.*relate).*night.* the text that I'm matching against is: credited back on night s...
Ut asked 28/7, 2016 at 20:4

3

Solved

Is it possible to do string negation in regular expressions? I need to match all strings that do not contain the string "..". I know you can use ^[^\.]*$ to match all strings that do not contain "....
Ironstone asked 20/7, 2009 at 14:15

2

I am trying to create a regular expression using POSIX (Extended) Regular Expressions that I can use in my C program code. Specifically, I have come up with the following, however, I want to exclud...
Scandium asked 13/3, 2013 at 5:5

3

Solved

I'm currently using a scanning software "Drivve Image" to extract certain information from each paper. This software enables certain Regex code to be run if needed. It seems to be run with the Ultr...
Dunkle asked 30/5, 2016 at 12:55

5

Solved

There are some features in modern regex engines which allow you to match languages that couldn't be matched without that feature. For example the following regex using back references matches the l...
Advocacy asked 4/6, 2010 at 12:44

5

Solved

I'm trying to write a regex that can match ONLY those lines where every white-space separated token occurs exactly twice, regardless of order. For example, the entirety of the following lines shoul...
Oxyacetylene asked 27/12, 2023 at 19:43

3

Solved

I want to match a string which may contain a type of character before the match, or the match may begin at the beginning of the string (same for end of string). For a minimal example, consider the...
Ingaborg asked 28/4, 2015 at 3:8

6

Solved

In Vim, is there a way to search for lines that match say abc but do not also contain xyz later on the line? So the following lines would match: The abc is the best The first three letters are abc...
Geber asked 15/1, 2014 at 21:20

15

Obviously, you can use the | (pipe?) to represent OR, but is there a way to represent AND as well? Specifically, I'd like to match paragraphs of text that contain ALL of a certain phrase, but in n...
Transcript asked 22/1, 2009 at 16:49

2

I am coding an app to practice English, I need a javascript regular expression to find all the docs in a mongoDb collection on which the 'answer' property contains a word that ends in ing and exclu...
Weekley asked 3/3, 2019 at 17:35

2

Solved

I have a dataframe in R. I want to match with and keep the row if "woman" is the first or the second word in a sentence, or if it is the third word in a sentence and preceded by the word...
Jude asked 30/12, 2022 at 15:58

2

This is the fourth part in a series of educational regex articles. It show how the combination of nested reference (see: How does this regex find triangular numbers?) to "count" within a...
Plainsman asked 12/9, 2010 at 4:6

3

Solved

I am trying to handle un-matched double quotes within a string in the CSV format. To be precise, "It "does "not "make "sense", Well, "Does "it" should ...
Addy asked 20/11, 2013 at 7:31

2

Solved

Is there a way to use same name in regex named group in python? e.g.(?P<n>foo)|(?P<n>bar). Use case: I am trying to capture type and id with this regex: /(?=videos)((?P<type>vide...
Mannikin asked 9/6, 2017 at 14:42

4

Solved

I've almost got the answer here, but I'm missing something and I hope someone here can help me out. I need a regular expression that will match all but the first letter in each word in a sentence....
Chausses asked 25/1, 2011 at 5:40

3

Solved

I want to write a java Regular expression that recognises the following patterns. abc def the ghi and abc def ghi I tried this: abc def (the)? ghi But, it is not recognizing the second pattern...
Jesher asked 14/9, 2015 at 13:27

1

Solved

Based on the documentation for Raku's lookaround assertions, I read the regex / <?[abc]> <alpha> / as saying "starting from the left, match but do not not consume one character tha...
Chemurgy asked 31/8, 2021 at 19:29

3

Solved

I want to match the word gay unless it is part of the word megayacht. I know I can use negative lookahead and negative lookbehind to exclude gayacht or megay from the match, e.g (?<!me)gay and ...
Desberg asked 7/8, 2021 at 11:55

2

Solved

I'm not terribly certain what the correct wording for this type of regex would be, but basically what I'm trying to do is match any string that starts with "/" but is not followed by "bob/", as an ...
Ulberto asked 4/4, 2012 at 0:12

9

Solved

I have implemented a generator-based scanner in Python that tokenizes a string into tuples of the form (token type, token value): for token in scan("a(b)"): print token would print ("literal",...
Mnemonic asked 5/10, 2009 at 1:10

6

Solved

I am attempting to grep for all instances of Ui\. not followed by Line or even just the letter L What is the proper way to write a regex for finding all instances of a particular string NOT follow...
Chichi asked 8/2, 2012 at 16:52

1

Solved

Note: The observed behavior is correct, but may at first be surprising; it was to me, and I think it may be to others as well - though probably not to those intimately familiar with regex engines....
Jae asked 2/3, 2021 at 19:59

1

Solved

How can I use capturing groups inside lookahead assertion? This code: say "ab" ~~ m/(a) <?before (b) > /; returns: 「a」 0 => 「a」 But I was expecting to also capture 'b'. Is the...
Geriatric asked 18/11, 2020 at 17:37

1

Solved

I think I have some misunderstanding about how a positive Lookbehind works in Regex, here is an example: 12,2 g this is fully random 89 g random string 2 0,6 oz random stuff 1 really random stuff ...
Aeolis asked 26/9, 2020 at 12:37

5

Solved

Regex to allow only number between 1 to 12 I am trying (12)|[1-9]\d? but its not working, please help as i am new to regular expression
Metzler asked 7/9, 2015 at 10:2

© 2022 - 2025 — McMap. All rights reserved.