regex-greedy Questions

16

Solved

I'm testing one application where Regex pattern match credit card then such numbers should be highlighted. I'm using site http://regexpal.com/ to create test credit credit card numbers for my testi...
Propositus asked 16/2, 2012 at 17:5

4

Solved

I have a regex pattern that is supposed to match at multiple places in a string. I want to get all the match groups into one array and then print every element. So, I've been trying this: #!/bin...
Bourse asked 14/12, 2016 at 12:44

4

Solved

How do I tell RegEx (.NET version) to get the smallest valid match instead of the largest?
Cone asked 17/12, 2009 at 7:12

13

Solved

What are these two terms in an understandable way?
Commemorate asked 20/2, 2010 at 6:17

5

Solved

My string being of the form: "as.asd.sd fdsfs. dfsd d.sdfsd. sdfsdf sd .COM" I only want to match against the last segment of whitespace before the last period(.) So far I am able to cap...
Adala asked 26/1, 2017 at 9:14

27

Solved

I'm trying to use sed to clean up lines of URLs to extract just the domain. So from: http://www.suepearson.co.uk/product/174/71/3816/ I want: http://www.suepearson.co.uk/ (either with or without ...
Gaslight asked 9/7, 2009 at 10:47

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

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

7

Solved

I want to grep the shortest match and the pattern should be something like: <car ... model=BMW ...> ... ... ... </car> ... means any character and the input is multiple lines.
Quite asked 12/6, 2010 at 4:43

5

Solved

I'm reading the regular expressions reference and I'm thinking about ? and ?? characters. Could you explain me with some examples their usefulness? I don't understand them enough. thank you
Grader asked 7/4, 2011 at 15:26

1

Solved

I thought that in regular expressions, the "greediness" applies to quantifiers rather than matches as a whole. However, I observe that grep -E --color=auto 'a+(ab)?' <(printf "aab") returns ...
Desiderative asked 2/12, 2019 at 11:14

7

Solved

How do I make a python regex like "(.*)" such that, given "a (b) c (d) e" python matches "b" instead of "b) c (d"? I know that I can use "[^)]" instead of ".", but I'm looking for a more general s...
Spermatogonium asked 19/4, 2009 at 23:24

3

Solved

I need find the last index of set of characters in a string. Consider the set of characters be x,y,z and string as Vereador Luiz Pauly Home then I need index as 18. So for finding the index I have...
Gilles asked 4/6, 2019 at 9:14

2

Solved

I am trying to program a method to convert subtitle files, such that there is always just one sentence per subtitle. My idea is the following: For each subtitle: 1.1 -> I get the subtitle dura...
Ukase asked 17/5, 2019 at 14:54

5

Solved

I'm bit confused by NSRegularExpression in swift, can any one help me? task:1 given ("name","john","name of john") then I should get ["name","john","name of john"]. Here I should avoid the brac...
Wakerly asked 18/5, 2019 at 2:49

4

This pattern: /a+?b+?/ Against the following string: aaaaaabbbbbb Matches: aaaaaab We see that the non-greedy behaves different in backward/left direction (takes all) and forward/right dir...
Pompei asked 3/3, 2013 at 21:47

4

Solved

Does Notepad++ support non-greedy regular expressions? For example for text: abcxadc I want to get parts using pattern: a.+c And now I get whole string instead of 2 parts. I tried to use the...
Lanny asked 19/10, 2010 at 17:34

3

Solved

I need help about regular expression matching with non-greedy option. The match pattern is: <img\s.*> The text to match is: <html> <img src="test"> abc <img src="a"...
Hamner asked 10/8, 2012 at 9:37

3

Solved

I am having problems with this mini-grammar, which tries to match markdown-like header constructs. role Like-a-word { regex like-a-word { \S+ } } role Span does Like-a-word { regex span { <l...
Conflagration asked 5/1, 2018 at 9:1

1

Solved

I am trying to match all URIs that begin with #/tool_[a-z\-]+# except if it's followed by /public. Such as /tool_calculator or whatever. For example, if the URI begins with /tool_store-front or /t...
Seaweed asked 31/3, 2017 at 20:51

8

Solved

I have a big HTML file that has lots of markup that looks like this: <p class="MsoNormal" style="margin: 0in 0in 0pt;"> <span style="font-size: small; font-family: Times New Roman;">s...
Pristine asked 20/8, 2009 at 12:28

1

Solved

How can I use SSMS 2016 regex replace feature to remove extra spaces and tabs at the end of lines? Example of editor content: select 'tab' , 'space' select 'tabs' , 'spaces' Goal: selec...
Diffraction asked 11/8, 2016 at 14:21

1

Solved

I'm trying to get the value of the value entry in this xml line via terminal so I'm using sed. abcs='<param name="abc" value="bob3" no_but_why="4"/>' echo $abcs | sed -e 's/.*value="\(.*\)...
Necaise asked 11/7, 2016 at 20:32

4

Solved

I have a string whose correct syntax is the regex ^([0-9]+[abc])+$. So examples of valid strings would be: '1a2b' or '00333b1119a555a0c' For clarity, the string is a list of (value, letter) pairs ...
Compensatory asked 25/3, 2016 at 8:50

1

Solved

In the documentation for the Java Pattern class, I see that the exact quantifier X{n} has both greedy and reluctant forms: Greedy quantifiers X{n} X, exactly n times ... Reluctant qua...
Depth asked 20/3, 2016 at 4:41

© 2022 - 2024 — McMap. All rights reserved.