Home  >  Article  >  Backend Development  >  求一简单的正则表达式

求一简单的正则表达式

WBOY
WBOYOriginal
2016-06-23 14:10:27885browse

preg_match_all('/字符串开始(.*?)回车/Us', $snoopy->results,$snoopy->results);
在分析网页的时候,我用上面的表达式截取“字符串开始”和回车之间的那个字符串。 这个回车应该怎么写呢? 我怎么写都不对, 郁闷死了


回复讨论(解决方案)

preg_match_all('/字符串开始(.*?)\s*/Us', $snoopy->results,$snoopy->results);

\r表示回车,\n表示换行

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:bat执行PHP文件Next article:PHP分页问题,求大神指导