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 "/"...
1 Answer
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}
2 Comments
pho
This 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.Δημητρης Τζιαβρας
thank you ...that was exactly what i couldnt find