1
puting在我有這樣的正則表達式如何agroup PHP中的正則表達式,而不對陣列
if (preg_match('/(Seg|Segunda)? [aà] (Sex|sexta)?: (de)?\s?(\d{1,2})h?(\d{2})? [aà]s (.*?)h(\d{2})?/is', $obj["horario"], $hora))
,如果我想使用裏面的()值的像$hora[1]
,$hora[2]
...等數組,問題是我不想把數組0123'像(Seg|Segunda)?
,因爲我只想要數字expreisons,任何方式不要把它們放在裏面?
對不起,但我不知道你的意思。也許例子? – AbraCadaver
使用非捕獲組 - 「(Seg | Segunda)'=>'(?:Seg | Segunda)'。它是否按照您期望的方式工作? –
@WiktorStribiżew是的,謝謝兄弟! –