Im trying to check if a user's input is following the pattern integer/integer/integer(like month/day/year) but i dont know how to use exactly the match function to define that the pattern contains "number",then "/",again "number" and "/"...
Asked
Active
Viewed 49 times
1 Answers
-2
Check out https://regex101.com/ for a neat website to check your regex! This is implemented in python using the re library. https://docs.python.org/3/library/re.html
In your case, the pattern would be [0-9]{1,2}\/[0-9]{1,2}\/[0-9]{2,4}

David_Leber
- 146
- 6
-
2This allows `00/00/2022`, or any number of other invalid dates. Also, simple questions such as this one have usually already been asked and answered on Stack Overflow. In such situations, the recommended action is to flag / vote to close this question as a duplicate, instead of adding an answer. – Pranav Hosangadi Sep 07 '22 at 16:16
-
thank you ...that was exactly what i couldnt find – Δημητρης Τζιαβρας Sep 08 '22 at 09:49