reusing parts of a string in RE matches?
John Salerno
johnjsal at NOSPAMgmail.com
Wed May 10 14:28:44 EDT 2006
BartlebyScrivener wrote:
> I have to at least try :)
>
> s = "abababababababab"
>
> for x in range(len(s)):
> ... try:
> ... s.index("aba", x, x + 3)
> ... except ValueError:
> ... pass
>
> rd
>
yeah, looks like index() or find() can be used to do it instead of RE,
but still, i'd like to know if there's a way you can write an RE
expression to do it (and just an RE expression, without all the other
for loops and extra nonsense...otherwise i might as well just use string
methods)
More information about the Python-list
mailing list