I some text that looks like this:
Vind vid marken
12-14UTC: Område E3a: N/2-5 knop, byar upp till 13 knop.
Område E2b: N/2-5 knop, byar upp till 14 knop.
Område E1a,E1b: NV-N/0-6 knop, byar upp till 15 knop.
Område E2a: N/1-6 knop, byar upp till 12 knop.14-16UTC: Område E1b: N/2-6 knop, byar upp till 16 knop.
Område E3a: N/3-6 knop.
Område E2b: N/3-5 knop.
Område E2a: N/1-5 knop, byar upp till 12 knop.
Område E1a: N/0-6 knop, byar upp till 14 knop.16-18UTC: Område E1b: N-NO/1-7 knop, byar upp till 15 knop.
Område E2a,E2b: N/0-4 knop, byar upp till 12 knop.
Område E1a: N-NO/3-8 knop, byar upp till 15 knop.
Område E3a: N-NO/1-6 knop, byar upp till 13 knop.18-20UTC: Område E2b,E3a: N-NO/1-5 knop.
Område E1b,E2a: N-NO/0-5 knop, byar upp till 11 knop.
Område E1a: N-NO/1-7 knop.
My goal is to find the value of the correct location and time.
As you can see the text is deceived in times and in areas (for example E3a), and it repeats the same area in the next time interval.
With this regex: preg_match_all("/(\d{2}-\d{2})UTC/", $text, $arr);
I get this array:
array(2
0 => array(4
0 => 12-14UTC
1 => 14-16UTC
2 => 16-18UTC
3 => 18-20UTC
)
1 => array(4
0 => 12-14
1 => 14-16
2 => 16-18
3 => 18-20
)
)
Right now the time is 14:52 UTC.
How do I... lets say echo $arr[1][1]
, because I know the current time is between 14 and 16?
I need the regex to be either the way it is above, or at least maintain $arr[0]
because I need that in the next regex pattern.
I'm stuck here because I can't figure out how to know what time interval it is I need in the next regex.