Apr-29-2018, 04:32 PM
Hi,
I am beginning with regex in python and i am having trouble with an exercise.
It may be very simple and i am probably doing something very wrong but i can t figure out what.
I am supposed to check the format of mail adresses:
-it has to begin with 1 to 4 letters between a and p
-then 0 to 4 number between 0 and 10
-then @gmail.com
I am supposed to write a rule that check that, i wrote :
'([a-p]{1,4})([0,9]{0,4})([@]{1,1})[g][m][a][i][l][\.][c][o][m]$'
It does not work all the time, what am i doing wrong? is there a better way to do it?
Thank you very much for your help and understanding
I am beginning with regex in python and i am having trouble with an exercise.
It may be very simple and i am probably doing something very wrong but i can t figure out what.
I am supposed to check the format of mail adresses:
-it has to begin with 1 to 4 letters between a and p
-then 0 to 4 number between 0 and 10
-then @gmail.com
I am supposed to write a rule that check that, i wrote :
'([a-p]{1,4})([0,9]{0,4})([@]{1,1})[g][m][a][i][l][\.][c][o][m]$'
It does not work all the time, what am i doing wrong? is there a better way to do it?
Thank you very much for your help and understanding