我想返回三個詞組短語的每個實例的匹配。我現在不擔心正確的語法。我更關心如何實現請求的「多通」性質。正則表達式匹配每3個字符串
$string = "one two three four five";
$regex = '/(?:[^\\s\\.]+\\s){3}/ui';
preg_match_all($regex, $string, $matches);
只會返回:
one two three
所需的結果:
one two three
two three four
three four five
什麼是有問題的正則表達式的輸出? – user961954