문제

I try to grep a date. $m[0] is dpr_ts><'01/01/2002','31/12/2002'] .

I try to grep 01/01/2002 and 31/12/2002:

$se = preg_grep("/(\d{2}.\d{2}.\d{4})+/", $m);

I'm matching everything. I want to match the dates in an array $se[0] = '01/01/2002' and $se[1] = 31/12/2002.

도움이 되었습니까?

해결책

You want preg_match_all:

preg_match_all("/(\d{2}.\d{2}.\d{4})+/", $m[0], $se);

print_r($se);

Also, using $m[0] makes me suspect that this was a match from a previous preg_match or preg_match_all? Maybe you could do it there and not have so many steps?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top