To search a word in a group of words, say a paragraph or a web page,
would a string search or a regexp search be faster?
The string search would of course be,
if str.find(substr ) != -1:
domything()
And the regexp search assuming no case restriction would be,
strre=re.compil e(substr, re.IGNORECASE)
m=strre.search( str)
if m:
domything()
I was about to do a test, then I thought someone here might have
some data on this already.
Thanks folks!
-Anan
would a string search or a regexp search be faster?
The string search would of course be,
if str.find(substr ) != -1:
domything()
And the regexp search assuming no case restriction would be,
strre=re.compil e(substr, re.IGNORECASE)
m=strre.search( str)
if m:
domything()
I was about to do a test, then I thought someone here might have
some data on this already.
Thanks folks!
-Anan
Comment