I am trying to extract the GMT number from the following text:
All times are GMT -3. The time now is 07:00 PM. Archive
I have the code:
data = "All times are GMT -3. The time now is 07:00 PM. Archive";
var myregex = /s\GMT([^"]*)./;
var matchArray = myregex.exec(data);
But it doesn't seem to work. In this example I am trying to get "-3" into matchArray How can I get the string after the space after GMT and before the period? Thanks!
\s, nots\. There is nosin front ofGMTin your input string, that's why/s\GMTdoesn't match. Maybe it even tries to match\literally, I don't know.