Regular expression returning an index where match was found?
Jon Nicoll
jkn at nicorp.f9.co.uk
Thu Jul 8 11:15:56 EDT 2004
Hi All
I would like to be able to use regular expression searches to
determine the index(es) within a string where a match was found. ie.,
given
import re
def myFunc():
# to be written ;-)
the call
myfunc("abc", "abcdefabcabc")
would return (say) a list [0, 6, 9]
I can't see a straightforward way of doing this from reading the
Regular Expression HOWTO and the python docs; any
pointers/suggestions?
Thanks
Jon N
More information about the Python-list
mailing list