In Ukraine, as of 2020, there are three major mobile operators and three smaller ones.

 

For a complete understanding of what is described below, I will clarify a few points right away.

Python version 3 is used, and accordingly, the regular expressions will be for this version; I do not know if it will work with previous versions.

The built-in library re will be used for working with regular expressions.

X — any digit

phone — phone number in the format 380XXXXXXXXX

 

Codes and regular expressions for Python for major operators:

Kyivstar:

Mobile network codes — 067,068, 096, 097, 098. Number of subscribers — 26.4 million (in the third quarter of 2019).

CodeFull numberRegular expression
09838098XXXXXXXre.match(r'^38098[0-9]{7}$', phone)
09738097XXXXXXXre.match(r'^38097[0-9]{7}$', phone)
09638096XXXXXXXre.match(r'^38096[0-9]{7}$', phone)
06838068XXXXXXXre.match(r'^38068[0-9]{7}$', phone)
06738067XXXXXXXre.match(r'^38067[0-9]{7}$', phone)

Regular expression for identifying the Kyivstar operator considering all its codes:

re.match(r'^3806[7,8][0-9]{7}$|^3809[6-8][0-9]{7}$', phone)

 

Lifecell:

Mobile network codes — 063, 073, 093 . Number of subscribers — 6.9 million subscribers (in the third quarter of 2019).

CodeFull numberRegular expression
06338063XXXXXXXre.match(r'^38063[0-9]{7}$', phone)
07338073XXXXXXXre.match(r'^38073[0-9]{7}$', phone)
09338093XXXXXXXre.match(r'^38093[0-9]{7}$', phone)

Regular expression for identifying the Lifecell operator considering all its codes:

re.match(r'^380[6,7,9]3[0-9]{7}$', phone)

 

Vodafone (MTS):

Mobile network codes — 050, 066, 095, 099 . Number of subscribers — 19.6 million subscribers (in the first quarter of 2019).

CodeFull numberRegular expression
05038050XXXXXXXre.match(r'^38050[0-9]{7}$', phone)
06638066XXXXXXXre.match(r'^38066[0-9]{7}$', phone)
09538095XXXXXXXre.match(r'^38095[0-9]{7}$', phone)
09938099XXXXXXXre.match(r'^38099[0-9]{7}$', phone)

Regular expression for identifying the Vodafone (MTS) operator considering all its codes:

re.match(r'^38050[0-9]{7}$|^38066[0-9]{7}$|^3809[5,9][0-9]{7}$', phone)

 

Trimob:

Mobile network code — 091. Number of subscribers — 250 thousand (as of April 20, 2018).

CodeFull numberRegular expression
09138091XXXXXXXre.match(r'^38091[0-9]{7}$', phone)

Regular expression for identifying the Trimob operator considering all its codes: