I am wanting to end up with this string: "March 8, 10:46 AM"
This is what I am using:
Code: Select all
updateList=newList();
updateTimeRaw="Last Updated on March 8, 10:46 AM MST";
matches(updateTimeRaw, '\\w+ \\d{1,2}, \\d{1,2}:\\d{2} \\w{2}', updateList);
updateTime=getElement(updateList, 0);
08.03.2016 13:35:04.325 [Get Weather] End executing action 'Script: Weather Info' and exception Error while calling function getElement (Expression: getElement(updateList, 0)[line 11], Cause: Invalid index 0, size is 0)
I am reading this to mean that there are no matches stored in updateList.
The regex that I am using is pretty basic and works a treat in any tester that I have checked it in. I tried breaking it down to see if I could locate where I was going wrong. Changing it to '.*' works as expected and matches the entire string which is returned properly by the getElement function. Changing that to just the first element of the original regex, '\\w+', results in the same error.
Is there some quirk in Automagic that I have missed in my search for answers? I am using single quotes so the contents of the curly brackets are not evaluated. I am escaping the backslashes with another backslash. I have read everything I could find on the forum regarding regex and am coming up blank.