When determining whether an instance of substring exists in a larger string,
I am considering two options:
(1)
if "aaaa" in "bbbaaaaaabbb":
dosomething()
(2)
pattern = re.compile("aaaa")
if pattern.search("bbbaaaaaabbb"):
dosomething()
Which of the two are more efficient & faster (considering the size of the string is huge)??
Is there any other option that is faster??
Thanks