[ad_1]
You can use the Regex pattern:
(?:[A-Za-z.]*/PERSON\s*)+
[A-Za-z.]*matches zero or more of[A-Za-z.]/PERSON\s*matches/PERSONfollowed by zero or more whitespaceThe above is put in a non-captured group and the group is matched one or more time by the
+token.
Example:
In [9]: re.search(r'(?:[A-Za-z.]*/PERSON\s*)+', 'Leo/PERSON Messi/PERSON hello').group()
Out[9]: 'Leo/PERSON Messi/PERSON '
0
[ad_2]
solved Translate regular expression to python