How to individually match all numbers that immediately follow a keyword?
问题 I have this string: 28.6MH\/s 27.3MH\/s | Temp(C): 64 66 61 64 63 | Fan: 74% 76% 69% 75% 72% | HW: 21 21 21 and I want to extract the Temp values, but I can't figure out what I'm doing wrong. The expression that I came up with (and doesn't work) is: ((?<temp>\d\d)(?!\.).+(?!Fan))+ Debuggex Demo 回答1: Pattern: /(?:\G(?!^)|Temp\(C\):) \K\d+/ (Demo) Code: (Demo) $in='28.6MH\/s 27.3MH\/s | Temp(C): 64 66 61 64 63 | Fan: 74% 76% 69% 75% 72% | HW: 21 21 21 '; var_export(preg_match_all('/(?:\G(?!^)