一个非常基本的例子是
赏识
要回答regex部分:
preg_match('!
(.*)!s', '/p>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 bedroom
house
to rent in Caroline Place, Bayswater, W2 through Foxtons (Property to rent)
', $matches);
print_r($matches);
/* output:
Array
(
[0] =>
4 bedroom
house
to rent in Caroline Place, Bayswater, W2 through Foxtons (Property to rent)
[1] =>
4 bedroom
house
to rent in Caroline Place, Bayswater, W2 through Foxtons (Property to rent)
)
*/
这个
s
在regex的末尾,将解析器放入(不恰当地)调用的
single-line mode
.