Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Question about Expression
#3
Lazy regex "\S+?@" will consume the minimum number of characters until it reaches a white space character or until it reaches a character matching the subsequent character "@". In effect, it will start at the beginning of a character string that is not interrupted by white space and stop when it finds "@". Without the laziness, the regex engine might consume the "@" as part of "\S".

The lazy regex at the end only consumes a single character because that's all the engine needs to satisfy the regex.
Reply


Messages In This Thread
A Question about Expression - by IA22 - Aug-14-2020, 02:11 PM
RE: A Question about Expression - by Gribouillis - Aug-14-2020, 02:56 PM
RE: A Question about Expression - by stullis - Aug-14-2020, 04:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  regular expression question Skaperen 4 2,595 Aug-23-2021, 06:01 PM
Last Post: Skaperen
  Pass results of expression to another expression cmdr_eggplant 2 2,372 Mar-26-2020, 06:59 AM
Last Post: ndc85430
  regular expression question Sanlus 6 3,650 Aug-04-2018, 06:49 PM
Last Post: volcano63

Forum Jump:

User Panel Messages

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