Reputation: 45
Thank you for coming.
import re
content = '가나다라,456456 show, 가나다라<>'
a = re.search("[^a-zA-Z<>]+", content)
print(a.group())
Output : 가나다라,456456.
but I want this
Output : 가나다라,456456 , 가나다라
In other words, I want to search the full text . What can i do? :(
Upvotes: 0
Views: 42
Reputation: 174796
You need to use re.findall
in-order to get all the matches. re.search
must return only the first match.
re.findall(r"[^a-zA-Z<>]+", content)
Example:
>>> import re
>>> content = '가나다라,456456 show, 가나다라<>'
>>> ''.join(re.findall("[^a-zA-Z<>]+", content))
'가나다라,456456 , 가나다라'
Upvotes: 1