I have a date which returns either "23-12-2010" or '2013-' I want to extract the valid year for 2013- ie. 2013 and valid date for 23-12-1010 i.e 23-12-2010. So I am trying to extract all the tring before last '-' if it is present.I have a date which returns either "23-12-2010"