I am trying to return -05:00 from the string (GMT-05:00) Eastern Time (US & Canada) with regex. I know this is a tedious question, but I have been researching for a couple of minutes and have gotten nowhere. Can anyone help? Thanks for taking a look!
I am trying to return -05:00 from the string (GMT-05:00) Eastern Time (US &
Share
What have you tried?
You could use
[+-][0-9]{2}:[0-9]{2}\bwhich matches a plus or minus sign followed by ‘dd:dd’ where ‘d’ is a digit. The trailing\bmakes sure that something like-12:234565won’t match.