Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex problem
#4
Quote:As per my understanding I expected words such as ORE, FRETED and REDED to pass but not words such as RENDED, DOPED or REPRO.

Why would ORE pass? There's no D in it.
Aside from that one, all your other examples pass/fail as you described. If you're not seeing that, then there's an issue with the code, not the regex.

When it comes to testing regex, I like using https://www.regexpal.com/
If you turn on the multiline flag, you can add all your examples on their own line, and FRETED and REDED light up, since they match. It helps to quickly see if a regex is doing what you think it is.

...but your regex is doing what you described it as doing. This one is pretty simple, it's when you start using things like negative lookahead groups where they can get very confusing.
ndc85430 likes this post
Reply


Messages In This Thread
Regex problem - by bontwoody - Dec-04-2021, 04:58 PM
RE: Regex problem - by Gribouillis - Dec-04-2021, 05:59 PM
RE: Regex problem - by bontwoody - Dec-04-2021, 06:08 PM
RE: Regex problem - by nilamo - Dec-04-2021, 09:22 PM

Forum Jump:

User Panel Messages

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