Page 1 of 1

求助 包含中括号的字符串的过滤

Posted: Jun 17 2008, 15:02
by foleo
比如 要把网页中的

Code: Select all

[img]url[/img]
过滤成

Code: Select all

<img src="url">
以便直接显示图片 可中括号是控制符 我想了很久 不会弄 只好用

Code: Select all

Match = "?img?http://\1?/img?"
Replace = "<img src="http://\1">"
请教一下 还有别的办法 严格一点实现么 这个 我担心会有例外会误过滤

Re: 求助 包含中括号的字符串的过滤

Posted: Jun 17 2008, 15:52
by phoenix
meta character请用“\”escape。
\ The Backslash can be used to "escape" any character that has special meaning and treat it as a normal character. For example, to match a parenthesis in the HTML text use "\(", to match a backslash itself use "\\".
基本语法请参考: http://www.proxomitron.cn/help/Matching%20Rules.html

Re: 求助 包含中括号的字符串的过滤

Posted: Jul 03 2008, 11:46
by imsheng
就是对于prox来说,对某些特殊字符进行转义的问题。呵呵。