In [12]:
import re
x = re.compile(r'\d\d-\d{10}')
y= x.search("my mobile 1122 is 91-8148586079")

In [13]:
print dir(y)


['__class__', '__copy__', '__deepcopy__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'end', 'endpos', 'expand', 'group', 'groupdict', 'groups', 'lastgroup', 'lastindex', 'pos', 're', 'regs', 'span', 'start', 'string']

In [14]:
y.group()


Out[14]:
'91-8148586079'

In [44]:
import re
x = re.compile(r'(\d\d)-(\d{10})')
y= x.findall("my mobile 1122 is 91-8148586079 and 91-9176966565")

In [46]:
y[1][1]


Out[46]:
'9176966565'

In [29]:
y.group(1)


Out[29]:
'91'

In [30]:
y.group(2)


Out[30]:
'8148586079'

In [35]:
import re
x = re.compile(r'(\d\d)-(\d{,10})')
y= x.search("my mobile 1122 is 91-812323424324324234")

In [36]:
y.group()


Out[36]:
'91-8123234243'

In [ ]: