Gerardlc Gerardlc - 3 months ago 44
PHP Question

PHP regular expresion hours

Hi i have this regular expression in php:

$programacion_array = preg_split("/(([0-9]{2}):([0-9]{2}))/",$html, -1, PREG_SPLIT_DELIM_CAPTURE);

I want to split a text by finding the hours of the programs, sample text:


But my regular expression is returning me this:

[1] => 06:20 [2] => 06 [3] => 20 [4] => Programold

I don't see what I am missing.


Try getting rid of the inner match groups, e.g. use just:


This will work as shown here: