Top "Non-greedy" questions

A technique used in regular expressions, that limits the matching text until all conditions of the given regex have been met.

How can I write a regex which matches non greedy?

I need help about regular expression matching with non-greedy option. The match pattern is: <img\s.*> The text …

regex regex-greedy non-greedy
What is the difference between .*? and .* regular expressions?

I'm trying to split up a string into two parts using regex. The string is formatted as follows: text to …

regex regex-greedy non-greedy
RegEx: Smallest possible match or nongreedy match

How do I tell RegEx (.NET version) to get the smallest valid match instead of the largest?

.net regex regex-greedy non-greedy
Greedy, Non-Greedy, All-Greedy Matching in C# Regex

How can I get all the matches in the following example: // Only "abcd" is matched MatchCollection greedyMatches = Regex.Matches("abcd", @"…

c# regex greedy regex-greedy non-greedy
Non-greedy Regular Expression in Java

I have next code: public static void createTokens(){ String test = "test is a word word word word big small"; Matcher …

java regex non-greedy
Regex Non-Greedy (Lazy)

I'm attempting to non-greedily parse out TD tags. I'm starting with something like this: <TD>stuff<TD …

c# regex html-table non-greedy
Can I have a non-greedy regex with dotall?

I would like to match dotall and non-greedy. This is what I have: img(.*?)(onmouseover)+?(.*?)a However, this is not …

python regex non-greedy
Sed replace at second occurrence

I want to remove a pattern with sed, only at second occurence. Here is what I want, remove a pattern …

regex bash sed non-greedy
Extract data between square brackets "[]" using Perl

I was using a regex for extracting data from curved brackets (or "parentheses") like extracting a,b from (a,b) …

regex perl non-greedy