背景PHP/HTML textarea的字符串的正則表達式(正則表達式)
在WordPress有一個叫做wpautop功能。它在輸出中自動添加段落br標籤。
問題
我有一個$內容字符串中一個textarea,我不希望這樣的textarea內自動格式化。字符串中可能多於一個textarea。
例串 - 前wpautop
This is my text. My paragraph.
<textarea class="test">
<html>Code test</html>
</textarea>
例串 - wpautop後
<p>This is my text. My paragraph</p>
<textarea class="test">
<br />
<html>Code test</html><br />
</textarea>
可能的解決方案
- 以某種方式創建一個包含字符串中所有textareas的數組。運行wpautop並將它們再次插入到字符串中。
- 請勿使用wpautop。改爲使用新的正則表達式。
我不熟悉WordPress的,但有什麼''標籤的'textarea'裏面做什麼? – bummzack 2012-02-16 17:16:48
這也是值得一提的事情。 – 2012-02-16 17:18:03
這是爲了呈現代碼,但它應該是<html>。 – 2012-02-16 17:19:27