■ 그룹핑 문자열 재참조하기

----------------------------------------------------------------------------------------------------

import re

 

srePattern = re.compile(r'(\b\w+)\s+\1')

sreMatch = srePattern.search('Paris in the the spring')

print(sreMatch.group())

 

[결과]

 

'the the'

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요