import re
"""
pattern = r"(test)*"
string = "test"
match = re.match(pattern, string)
print(match)

pattern = r"(test)*"
string = "testtest"
match = re.match(pattern, string)
print(match)

pattern = r"(test|text)*"
string = "testtest"
match = re.match(pattern, string)
print(match)
string = "testtext"
match = re.match(pattern, string)
print(match)

pattern = r"abc|(test|text)*"
string = "testtext"
match = re.match(pattern, string)
print(match)

pattern = r"abc|(test|text)*"
string = "abc"
match = re.match(pattern, string)
print(match)

pattern = r"((abc)|(test|text)*)"
string = "abc"
match = re.match(pattern, string)
print(match)
print(match.groups())

pattern = r"((abc)|(test|text)*)"
string = "testtext"
match = re.match(pattern, string)
print(match)
print(match.groups())

pattern = r"((abc)|(test|text)*)"
string = "testtexttest"
match = re.match(pattern, string)
print(match)
print(match.groups())

pattern = r"Hello (abc|test)"
string = "Hello abc"
match = re.match(pattern, string)
print(match)
print(match.group())
print(match.group(0))
print(match.group(1))

pattern = r"(\w+)-\1"
string = "test-test"
match = re.match(pattern, string)
print(match)
print(match.groups())

pattern = r"(\w+)-\1"
string = "test-text"
match = re.match(pattern, string)
print(match)

pattern = r"(\w+)-\1"
string = "test-test chow-chow"
duplicates = re.sub(pattern, r"\1", string)
print(duplicates)
"""

pattern = r"(\w+)-\1"
string = "test-test chow-chow"
duplicates = re.findall(pattern, string)
print(duplicates)

pattern = r"((\w+)-\2)"
string = "test-test chow-chow"
duplicates = re.findall(pattern, string)
print(duplicates)


c7c372e833ea99aa16c26408cfa69f6703717149
<mask token>

<mask token>
print(duplicates)
<mask token>
print(duplicates)

<mask token>
pattern = '(\\w+)-\\1'
string = 'test-test chow-chow'
duplicates = re.findall(pattern, string)
print(duplicates)
pattern = '((\\w+)-\\2)'
string = 'test-test chow-chow'
duplicates = re.findall(pattern, string)
print(duplicates)

import re
<mask token>
pattern = '(\\w+)-\\1'
string = 'test-test chow-chow'
duplicates = re.findall(pattern, string)
print(duplicates)
pattern = '((\\w+)-\\2)'
string = 'test-test chow-chow'
duplicates = re.findall(pattern, string)
print(duplicates)

import re
"""
pattern = r"(test)*"
string = "test"
match = re.match(pattern, string)
print(match)

pattern = r"(test)*"
string = "testtest"
match = re.match(pattern, string)
print(match)

pattern = r"(test|text)*"
string = "testtest"
match = re.match(pattern, string)
print(match)
string = "testtext"
match = re.match(pattern, string)
print(match)

pattern = r"abc|(test|text)*"
string = "testtext"
match = re.match(pattern, string)
print(match)

pattern = r"abc|(test|text)*"
string = "abc"
match = re.match(pattern, string)
print(match)

pattern = r"((abc)|(test|text)*)"
string = "abc"
match = re.match(pattern, string)
print(match)
print(match.groups())

pattern = r"((abc)|(test|text)*)"
string = "testtext"
match = re.match(pattern, string)
print(match)
print(match.groups())

pattern = r"((abc)|(test|text)*)"
string = "testtexttest"
match = re.match(pattern, string)
print(match)
print(match.groups())

pattern = r"Hello (abc|test)"
string = "Hello abc"
match = re.match(pattern, string)
print(match)
print(match.group())
print(match.group(0))
print(match.group(1))

pattern = r"(\w+)-\1"
string = "test-test"
match = re.match(pattern, string)
print(match)
print(match.groups())

pattern = r"(\w+)-\1"
string = "test-text"
match = re.match(pattern, string)
print(match)

pattern = r"(\w+)-\1"
string = "test-test chow-chow"
duplicates = re.sub(pattern, r"\1", string)
print(duplicates)
"""

pattern = r"(\w+)-\1"
string = "test-test chow-chow"
duplicates = re.findall(pattern, string)
print(duplicates)

pattern = r"((\w+)-\2)"
string = "test-test chow-chow"
duplicates = re.findall(pattern, string)
print(duplicates)

