I am trying to capture a mobile number without any country code in the match. As far as I know, this is only possible by using lookaround assertions.
m="919876543210"
re.match(r"^(?<=91)[0-9]+", m)
But there is no match at all. Can someone kindly point out the mistake here?
EDIT:
The string can have number with or without country code. (Assume country code can only be 91) so,
m = "91xxxxxxxxxx"
m = "xxxxxxxxxx"
The problem is if I use an optional group ( regex = r"(91)?\d+"
), then the country code is included in the match.
How can we handle both the cases without including the country code in the result?