Python Forum
RE-greedy or non greedy about '?'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RE-greedy or non greedy about '?'
#4
greedy:
https://regex101.com/r/QmYBkp/1
from the explanations on the right-hand side:
Quote:"yd?" gm
y matches the character y literally (case sensitive)
d? matches the character d literally (case sensitive)
? Quantifier — Matches between zero and one times, as many times as possible, giving back as needed (greedy)

lazy:
https://regex101.com/r/qvKqqU/1
from the explanations on the right-hand side:
Quote:"yd??" gm
y matches the character y literally (case sensitive)
d? matches the character d literally (case sensitive)
? Quantifier — Matches between zero and one times, as few times as possible, expanding as needed (lazy)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE-greedy or non greedy about '?' - by frank0903 - Jun-01-2020, 04:17 AM
RE: RE-greedy or non greedy about '?' - by buran - Jun-01-2020, 04:38 AM
RE: RE-greedy or non greedy about '?' - by buran - Jun-01-2020, 08:17 AM
RE: RE-greedy or non greedy about '?' - by buran - Jun-01-2020, 10:03 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020