fork download
  1. import re
  2. texts = ['+9812345678','+99123456789']
  3. for s in texts:
  4. print(re.findall(r'^\+9[98]|\d{2}(?:\d$)?', s))
Success #stdin #stdout 0.02s 9620KB
stdin
Standard input is empty
stdout
['+98', '12', '34', '56', '78']
['+99', '12', '34', '56', '789']