How can I tell if a string repeats itself in Python?

I’m looking for a way to test whether or not a given string repeats itself for the entire string or not. Examples: [ ‘0045662100456621004566210045662100456621’, # ‘00456621’ ‘0072992700729927007299270072992700729927’, # ‘00729927’ ‘001443001443001443001443001443001443001443’, # ‘001443’ ‘037037037037037037037037037037037037037037037’, # ‘037’ ‘047619047619047619047619047619047619047619’, # ‘047619’ ‘002457002457002457002457002457002457002457’, # ‘002457’ ‘001221001221001221001221001221001221001221’, # ‘001221’ ‘001230012300123001230012300123001230012300123’, # ‘00123’ ‘0013947001394700139470013947001394700139470013947’, # ‘0013947’ ‘001001001001001001001001001001001001001001001001001’, # ‘001’ ‘001406469760900140646976090014064697609’, # … Read more

Regular expression to match a line that doesn’t contain a word

I know it’s possible to match a word and then reverse the matches using other tools (e.g. grep -v). However, is it possible to match lines that do not contain a specific word, e.g. hede, using a regular expression? Input: hoho hihi haha hede Code: grep “<Regex for ‘doesn’t contain hede’>” input Desired output: hoho … Read more