看板 [ PHP ]
討論串[請益] 請教一下 ereg_replace 的用法
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者curewater (cure)時間19年前 (2006/04/29 22:22), 編輯資訊
0
0
0
內容預覽:
ereg比較好懂 但功能較preg弱 我習慣用preg. $s1 = '[email]xxx@xxx.xxx[/email]';. $pat1 = "/\[(\S+)\](\S+)\[(\S+)\]/";. $re = '[$1=$2]$2[$3]';. $s3 = preg_replace($pa

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者chweng時間19年前 (2006/04/28 10:45), 編輯資訊
0
0
1
內容預覽:
不好意思~. 因為找到的正規表達式資料都看不太懂,所以上來請教一下。. 我想將字串 '[email]xxx@xxx.xxx[/email]'. 取代為 [email=xxx@xxx.xxx]xxx@xxx.xxx[/email]. 並且,如果字串中不只一個這樣的內容,比如像這樣:. '[email]
(還有235個字)
首頁
上一頁
1
下一頁
尾頁