Python Forum
Regex to find triple characters
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regex to find triple characters
#5
(May-14-2024, 05:59 AM)deanhystad Wrote:
import re
matches =[match.group() for match in re.finditer(r"(.)\1{1,}", "AAAbbcDDDEDGGGG")]
print(matches)
Output:
['AAA', 'bb', 'DDD', 'GGGG']

Thank you, but this expression still allows matching consecutive characters other than exactly 3. Doubles, quads or others beside triples should not be found.
Reply


Messages In This Thread
Regex to find triple characters - by bfallert - May-14-2024, 12:28 AM
RE: Regex to find triple characters - by deanhystad - May-14-2024, 05:59 AM
RE: Regex to find triple characters - by bfallert - May-14-2024, 12:27 PM
RE: Regex to find triple characters - by deanhystad - May-14-2024, 01:08 PM
RE: Regex to find triple characters - by bfallert - May-14-2024, 01:28 PM
RE: Regex to find triple characters - by bfallert - May-14-2024, 12:29 PM
RE: Regex to find triple characters - by bfallert - May-14-2024, 12:32 PM
RE: Regex to find triple characters - by Pedroski55 - May-14-2024, 08:20 AM
RE: Regex to find triple characters - by bfallert - May-14-2024, 01:22 PM
RE: Regex to find triple characters - by Pedroski55 - May-14-2024, 01:04 PM
RE: Regex to find triple characters - by deanhystad - May-14-2024, 03:28 PM
RE: Regex to find triple characters - by xMaxrayx - May-16-2024, 04:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Find numbers using Regex giddyhead 18 3,597 Jul-28-2022, 12:29 AM
Last Post: giddyhead
  Find if chain of characters or number Frankduc 4 1,949 Feb-11-2022, 01:55 PM
Last Post: Frankduc
  Regex not finding all unicode characters tantony 3 2,411 Jul-13-2021, 09:11 PM
Last Post: tantony
  Find and replace in files with regex and Python Melcu54 0 1,936 Jun-03-2021, 09:33 AM
Last Post: Melcu54
  EOF while scanning triple-quoted string literal louis216 1 4,116 Jun-30-2020, 04:11 AM
Last Post: bowlofred
  How to find the first and last of one of several characters in a list of strings? tadsss 2 2,315 Jun-02-2020, 05:23 PM
Last Post: bowlofred
  Remove escape characters / Unicode characters from string DreamingInsanity 5 14,459 May-15-2020, 01:37 PM
Last Post: snippsat
  Find and replace to capitalize with Regex hermobot 2 2,629 Mar-21-2020, 12:30 PM
Last Post: hermobot
  Help converting MATLAB triple-for loop to Python davlovsky 1 2,075 Oct-29-2019, 10:26 PM
Last Post: scidam
  Do I always have to use triple quotes or \n for multi-line statements? DragonG 3 2,747 Oct-24-2018, 11:21 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

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