-2

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 "/"...

0

1 Answer 1

-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}

Sign up to request clarification or add additional context in comments.

2 Comments

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.