Need help with a regex

max_p_range_day = re.findall(r’max_p_range_day\s*=\s*’\d*[-,]?\d*[-,]?\d*’’, out)

Now I know what (\s*’\d*[-,]?\d*[-,]?\d*) this expression does it finds similiar expression like (‘2019-11-22’) , what I failed to understand is whole statement , before equals to .

can someone help me out .

1 Like


I dont understand if you’re looking for a test on dates formated like yyyy-mm-dd.
If that’s what you’re looking for, I believe than this regex will do the job.

let myDate = '2019-10-31'
let regexDate = /^\d{4}-\d{2}-\d{2}$/g
let test = regexDate.test(myDate)
let match = myDate.match(regexDate)
console.log('test' , test);
// return true
console.log('Match', match)
// return the date that matches

Hope it helps ( I used JS for this)

Hi ,

Actually the date is supposed to be assigned in max_p_range variable like
max_p_range = ‘yyyy-mm-dd’ including single quotes .
and later that code was supposed to check if the answer matched already saved answer.

But it is returning empty list. I failed to understand whole expression of re.findall , why there is variable name in it everything else.

max_range_day = re.findall(…, out )

out has the answer i put in the asked format.
thank you

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.