#!/usr/bin/env python
# Copyright 2014 Tomasz Wyderka <[email protected]>
##
import re

string  = "durian"
pattern = r"d(?:uria|bana)n"
flags   = 0 # re.DOTALL | re.MULTILINE

for m in re.finditer( pattern, string, flags ):
    print repr( m.group() ),
    print "from %d to %d" % m.span(),
    print "with groups: %s" % str( m.groups() ) 

print "String length: %d" % len(string)