Why does this regex not work over linebreak?
preg_match("/((?:(?:(?:[0][1-9]|1[0-2]|[0-9]):[0-5][0-9])\s(?:AM|PM)))/msiU", $input, $output_array);
does not match
text 13:30
PM moretext
From the regex you posted seems like you want to get the time from a multi-line string.
OK, the regex "\s" matches any new line, but in the case of your string there could be any number of white spaces.
Solution:
Replace \s with \s*
/((?:(?:(?:[0][1-9]|1[0-2]|[0-9]):[0-5][0-9])\s(?:AM|PM)))/msiU
/((?:(?:(?:[0][1-9]|1[0-2]|[0-9]):[0-5][0-9])\s*(?:AM|PM)))/msiU
\s* allows you to match any number of white space characters.
You can debug your regex at https://regex101.com/r/9Sz2Oi/1
Your corrected script at http://www.phpliveregex.com/p/joC (* Use preg_match_all)