+ 2

Please, tell my why it gives an error "Non value for arument 'string' in function call"?

I have to check the Phone number with 1or 8 or 9 and consists of 8 digits: import re #введите код сюда matched =re.match(r'^((\d[1|8|9])\d{8})+

#x27;) if matched: print ("Valid") else: print("Invalid")

30th Oct 2020, 6:54 AM
Elena Varvarchuk
Elena Varvarchuk - avatar
8 odpowiedzi
+ 3
Acc. to ur desc, the pattern should be, ^[189]\d{7}$
30th Oct 2020, 7:18 AM
777
777 - avatar
+ 6
Welcome Elena Varvarchuk ! An alternative to the pattern would be using separator ( | ) which is what I guess, you were trying... It would be, ^(1|8|9)\d{7}$
30th Oct 2020, 7:28 AM
777
777 - avatar
+ 3
I think you forgot to take input and pass it to match function. re.match("Your Pattern","Input String") So in your case string = input() matched = re.match(Your Pattern, string) Hope It Helps You 😊
30th Oct 2020, 7:03 AM
Hacker Badshah
Hacker Badshah - avatar
+ 2
спасибо) пока С# разбираю)) но по тихоньку буду приступать к питону))
30th Oct 2020, 7:12 AM
Sergey
Sergey - avatar
+ 1
Начинай, программирование это весело)
30th Oct 2020, 7:09 AM
Elena Varvarchuk
Elena Varvarchuk - avatar
0
i think to start object model pyton) подсказать не могу , пока ещё не начал изучать pyton 3)
30th Oct 2020, 7:08 AM
Sergey
Sergey - avatar
0
Can somone help with the regex, all time throwing "Nonvalid"
30th Oct 2020, 7:14 AM
Elena Varvarchuk
Elena Varvarchuk - avatar
- 1
@vrintle thank you very much!
30th Oct 2020, 7:21 AM
Elena Varvarchuk
Elena Varvarchuk - avatar