2011-09-28 4 views
3

아래 코드는 발생의 단일 인스턴스를 감지하지 못합니다. = O 뭐가 잘못 됐어? = \별표로 시작하는 줄을 탐지하는 정규식

별표로 시작하는 다음 줄 (줄 바꿈으로 시작하는 줄)을 어떻게 검색합니까? 나는 잃어 버렸다. 예상 한대로 작동하지 않습니다.

$text ="Nothing here to detect...though it is the first line. 
* '' [[test]] 
* Another line that starts with an asterisk 
** yet another...though it has two...but who cares about the 2nd one?"; 


$t = preg_match_all('#^\*.*#', $text, $match); 
echo "found=".$t."\n"; 
print_r($match); 

답변

관련 문제