Extracting search criteria using re

pauljolly at my-deja.com pauljolly at my-deja.com
Mon Jul 31 04:47:02 EDT 2000


Dear All,

I am using the re module to search for a particular string in an html
file (not within the tags but within the page material). This question
is more about regular expression technique more that anything.

I have read the manual on regular expression but cannot seem to find
anything that answers my question: when using the
(recompiledobject).split() method, I want to return a list of all the
occurences of my search criteria and not what remains when my search
criteria is stripped from the string. For example, searching using the
following search string: \d?\d\s*'°' in the following:

"This is an example of two temperatures 56 ° F and 36 ° F."

Applying the split function on the above, I would want to return as a
list ('56 °', '36 °'). I am sure this is possible but cannot
for the life of me find the answer. Any help much appreciated.

Regards,

Paul Jolly


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list