Extracting search criteria using re

pauljolly at my-deja.com pauljolly at my-deja.com
Mon Jul 31 05:50:58 EDT 2000


Sorry, I have found the answer to my question. I now use the findall()
function to extract the data. Sorry to trouble you all (but my other
question is still valid!!)

Paul Jolly

In article <8m3ee5$fh5$1 at nnrp1.deja.com>,
  pauljolly at my-deja.com wrote:
> 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.
>


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



More information about the Python-list mailing list