REGEX formatted date from string

This is a regular expression string to get YYYY-MM-DD string from arbitrary length string:

(19|20)dd([- /.])(0[1-9]|1[012])2(0[1-9]|[12][0-9]|3[01])

With Matlab/Octave regex for dates works like:

input = '09av8joj23oit2pojiijo/20398/vj89/2012-10-15/0298f9082j23'; %random stuff with date in it

regStr = '(19|20)dd([- /.])(0[1-9]|1[012])2(0[1-9]|[12][0-9]|3[01])';

[startIndex,endIndex] = regexp(input,regStr,'start','end')

myDate = input(startIndex:endIndex);