Python: How can I find text between certain words in a string?
https://stackoverflow.com/questions/59182312/python-how-can-i-find-text-between-certain-words-in-a-string
WEBYou can use re.findall method instead of re.search (re.search searches only for the first location where the regular expression pattern produces a match): import re. txt = '''asfas @111 dfsfds @222 dsfsdfsfsd dsfds. dsfsdfs sdfsdgsd @333 dsfsdfs dfsfsdf @444 dfsfsd. dsfssgs sdsdg @555 fsfh'''. print(*re.findall(r'@\d+', txt), sep='\n') Prints:
DA: 84 PA: 91 MOZ Rank: 60