rdearman wrote:kulaputra wrote:Serpent wrote::o I always write min or mins, never minutes...
"min" used to work. Now it doesn't, it seems. I'm not sure why. Also haven't tested "mins."
I can tell you that min isn't one of the tags in the code which it is looking for. Although it does some regular expression matching, I wouldn't depend on using shortened tags.
I looked in the code and this is what I found.
Code: Select all
// find a time in a string with hours and minutes, return with minutes
function findMinutesInString($string)
{
$minutes = findNumberInString($string, array("minutes", "minute", "mins", "min"));
$minutes += findNumberInString($string, array("hours", "hour", "hrs", "hr")) * 60;
return $minutes;
}
But the indNumberInString function it does
Code: Select all
$string = str_replace($keywords, ' xxxxx ', $string);
$string = preg_replace('/[^a-zA-Z0-9\s]/', ' ', $string); // make alphanumeric
$string = preg_replace('/\s\s+/', ' ', $string); // strip whitespace
$words = explode(' ', $string);
let's walk that...
first line replaces all those key words by ' xxxxx ' (note the space before and after. That means that '15mins' would get converted correctly to 15 xxxxx)
second line replaces all characters that are not alphanumerical or space by a space
third line reduces all spaces to single space
fourth line creates an array of words from the string
It then goes on to search for the keyword and returns the number prior to the keyword or 0.
I've no idea why it is failing on 'min', some of the time.
I am going to guess it has nothing to do with this bit of code.