You said that if it's bigger then 2 it will function, but what if we splits it and check for <= 52 for weeks <=12 for months and <=31 for days?
Then we have all options and the change it picks wrong format is hardly there, or do i forget something?
The $duration output of the given examples breaks at 7days > 1week, 4weeks > one month - Thus you'll always run into problems like
"I need a new
3d video card"
"from my house it's only
600m to the local store"
There's need for some other kind of checking... For example, if this would be a reply to a !seen script, a group enabled only for a couple of seconds on text !seen