My Regex:
(?<=(?i)start\s+date\s+)([0-9]{2}[\.]{1}[0-9]{2}[\.]{1}[0-9]{4})
I am trying to match a date which is preceded by the words 'start date' but only want the date to be returned.
So for example a match of 'start date 01.01.2000' should return '01.01.2000', I know I am close but I cant seem to get the first part of my expression to not be included in the results. Any help much appreciated
(?<=start\sdate)\s+([0-9]{2}[\.]{1}[0-9]{2}[\.]{1}[0-9]{4})
will work. I think the problem is with \s+, variable length look behind. Most regex engines don't implement variable length look behinds.
Try this:
(?<=start\sdate\s)([0-9]{2}\.[0-9]{2}\.[0-9]{4})
If you are always looking for a string that matches start date ##.##.####
, this would do:
start date ([0-9]{2}\.[0-9]{2}\.[0-9]{4})
however in that case, you could also simply do
substr($string, strrpos($string, "start date ") + 11, 10);