我不知道如何从此代码中获取全行内容。
$str = '
#chapter 1: title 1
content chapter 1 line 1
content chapter 1 line 2
content chapter 1 line 3
content chapter 1 line 4
#chapter 2: title 2
content chapter 2 line 1
';
preg_match_all('/#Chapter ([0-9]+.?[0-9]?)\s?(<([0-9]+)>)?:(.*)(\s+.+\s+)/i',$str, $match);
我试过这段代码,这得到了这样的内容:
$match[5][0]: 内容章节 1 第 1 行
$match[5][1]:内容第二章第二行
问题在: (\s+.+\s+)。
我怎样才能获得全行内容?!非常感谢。
慕哥9229398