Which is faster for searching strings regex or find() of Python?

Freen

New Member
I have an XML string \[code\]<tags> <person1>dave jones</person1> <person2>ron matthews</person2> <person3>sally van heerden</person3> <place>tygervalley</place> <ocassion>shopping</ocassion></tags>\[/code\]and I would like to search this xml string using search terms such as "Sally Van Heerden" or "Tygervalley" Is it faster to use regex to find the terms in this string or is the find() method of Python fast enough? I can also search using the element tree XML parser for python and then build the XML tree then searching it but I fear it will be too slow.Which of the above three is the fastest?Also any other suggestions?Keep in mind that there can be multiple search terms entered and also multiple(Thousands) XML strings will be searched.Update : what about splitting the xml string into a list, removing all special characters and then turning the list into a set and also a set of the search terms. Then get the intersection of the two sets? Would this be fast?
 
Back
Top