Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex problem
#1
Im having some difficulty understanding regex patterns. After reading around I constructed the following pattern.

['^.?RE..D$']

My understanding of this was:
^ indicated the start of the word
.? allowed zero or one character
RE were just that, the letter R and E
.. means exactly two characters
D as per RE
$ indicated the end of the word.

As per my understanding I expected words such as ORE, FRETED and REDED to pass but not words such as RENDED, DOPED or REPRO.

Ive obviously got this totally wrong, can anyone explain how and suggest the way in which I can achieve this sort of pattern?

Thanks in advance
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