gpt4 book ai didi

php - preg_replace() 多行

转载 作者:行者123 更新时间:2023-12-04 06:48:07 25 4
gpt4 key购买 nike

我再次遇到 preg_replace() 问题。我非常需要一本关于 preg_replace() 的书。

我的意图是替换 <td> author </td> <td> Level1 </td>
有任何想法吗? <td> author </td> 被其他 HTML 元素包裹:

<td align="center">
<a onclick="return listItemTask('cb1','block')" href="javascript:void(0);">
<img width="16" height="16" border="0" alt="Blocked" src="images/tick.png">
</a>
</td>
<td>
Author
</td>

最佳答案

来自 Perl regular expression manual page :(或 PHP PCRE docs)

Modifiers

Matching operations can have various modifiers. Modifiers that relate to the interpretation of the regular expression inside are listed below.

  • s: Treat string as single line. That is, change "." to match any character whatsoever, even a newline, which normally it would not match.

关于php - preg_replace() 多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3504474/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com