Regular Expression YYYY-MM-DD and YYYY MM DD
hi, i am a beginner in C++ using Qt4, i need help in writting the regular expression to accept YYYY-MM-DD and YYYY MM DD date formats.
Re: Regular Expression YYYY-MM-DD and YYYY MM DD
1. Did you try to find it? Here are some examples. You can modify them.
2. I will assume you are trying to validate user input. If that is true, then take a look at QDateTimeEdit. It should this validation for you.
Re: Regular Expression YYYY-MM-DD and YYYY MM DD
Quote:
Originally Posted by
lyuts
1. Did you try to find it?
Here are some examples. You can modify them.
2. I will assume you are trying to validate user input. If that is true, then take a look at
QDateTimeEdit. It should this validation for you.
The code below worked for this format, yyyy/MM/ dd i.e 2019/12/02
QRegExp R_date("(19[0-9][0-9]|20[0-9][0-9]) /(0[1-9]|[12]{1,2})/(0[1-9]|[12][0-9]|3[01]{1,2})");
QRegExpValidator *valida = new QRegExpValidator(R_date, this);
ui->lineEdit->setValidator(valida);