import re

p = re.compile('Q(.+?)E')
s = 'QUWESEADFQDFSAEDFS'
substrs = p.findall(s)

all_len = map(len, substrs)
index = all_len.index(min(all_len))

minsubstr = substrs[index]

On 25 Apr 2009, at 11:44, sandy wrote:

>
> hi can u plz help me to get  substrings between two characters at each
> occurence
> for eg:
>     to get all the substrings between Q and E in the given example
> sequence in all occurences.
>    ex: QUWESEADFQDFSAEDFS
>
>     and to find the substring with minimum length.
>
>     plz help me
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Python Ireland" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ie/group/pythonireland?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to