0
我正在開發自己的CMS並需要用正確的php函數替換自定義標記。
我的自定義標籤就像<cms:zone id="header" anotherAttr="attrValue" />
<cms:xxx />
部分對我很重要。
到目前爲止,我寫了這個正則表達式,但它不能正常工作。 <cms:?([\S|\s]*)\/>
正則表達式匹配<cms:xxx />自定義html標記
<body>
<cms:content id="footer" />
<cms:zone id="header" />
</body>
它將匹配
<cms:content id="footer" />
<cms:zone id="header" />
爲什麼不使用適當的DOM解析器? – 2013-03-02 12:54:01
我正在使用模板編譯器類的框架,這是我的需要,我只是將其修改爲我自己的目的。除了我聽說這種方法更快,但我不確定。 – mhesabi 2013-03-02 12:57:02