You can use the NSDataDetector (a cocoa method) for parsing date from a string.
Here's the script (tested on macOS Sierra):
Warning: on a string which contains "digit/digit/year", the script does not work with a string in the "day/month/year" format, the string must be in the "month/day/year" format
use framework "Foundation"
use scripting additions
(* this script works on these formats:
"Sunday 10th September 2017", "Sunday 10 September 2017", "Sunday 10 September 17", "September 10th, 2017", "September 10th 2017", "September 10 2017"
"10th September 2017", "10 September 2017", "10 Sep 17"
also work with the abbreviation ( e.g. Sep instead of September and Sun instead of Sunday)
also work with the localized name of (the month and the day)
"09/10/2017", "09.10.2017", "09-10-2017" : month_day_year only, or "2016/05/22", "2016-05-22", "2016.05.22" : year_month_day only
( month and days could be one or two digits)
*)
set myString to "Nov 5th, 2005"
set dateString to my stringToDate(myString) --> "05/11/2005"
on stringToDate(thisString) --
tell current application
-- ** finds all the matches for a date, the result is a NSArray **
set m to its ((NSDataDetector's dataDetectorWithTypes:(its NSTextCheckingTypeDate) |error|:(missing value))'s matchesInString:thisString options:0 range:{0, length of thisString})
if (count m) > 0 then
set d to (item 1 of m)'s |date|() -- get the NSDate of the first item
set df to its NSDateFormatter's new() -- create a NSDateFormatter
df's setDateFormat:"dd/MM/yyyy" -- a specified output format: "day/month/year" (day and month = two digits, year = 4 digits)
return (df's stringFromDate:d) as text
end if
end tell
return "" -- no match in this string
end stringToDate
day/month/year
, but your script returns amonth/day/year
string.