Running the following JavaScript code finds, for example, "12 December" successfully.
return messageHtmlBody.match(/[1-31]{1,2}(\s)[a-zA-Z]{3,9}/i)[0];
I would like to return "12 December 2012" so tried this code:
return messageHtmlBody.match(/[1-31]{1,2}(\s)[a-zA-Z]{3,9}(\s)\d{4}/i)[0];
Not only did this not return the match, but the code didn't even run successfully. I tried the following too (just the second (\s) character) and that didn't run either:
return messageHtmlBody.match(/[1-31]{1,2}(\s)[a-zA-Z]{3,9}(\s)/i)[0];
Is there a reason why the second (\s) wouldn't work? The first (\s) matches the first white space successfully. The search string 100% contains the string "12 December 2012" so finding it should not be the issue.
Any ideas?
"32".match(/[1-31]{1,2}/)returns["32"], so you may want to re-think your regex overall...