Re: [請益] 看不懂preg_replace函數的使用範例
※ 引述《fillmore (.......................)》之銘言:
: ※ 引述《fillmore (.......................)》之銘言:
: : 我用的是'/([^"]+)[\\]/'單引號括會錯=> missing terminating] for character class
: : 但是'/([^"]+)[\\\\]/' 這樣就沒錯
: : 不知道為什麼?
: 例子
: window.location=\'http://test.orz/download.php?session=25586136a8\'
: 這樣寫是正確=> '/http:\/\/test.orz\/download.php[?]session[=]([^"]+)[\\\\]/'
: 但是 [\\\\] 改成 [\\] 卻是錯誤
我錯了Orz
單引號只會處理\\和\'而已 其他不會處理
所以\還是得寫四個
--
'Oh, Harry, dont't you see?' Hermione breathed. 'If she could have done
one thing to make absolutely sure that every single person in this school
will read your interview, it was banning it!'
---'Harry Potter and the order of the phoenix', P513
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 192.192.197.115
→
06/28 20:26, , 1F
06/28 20:26, 1F
→
06/29 05:41, , 2F
06/29 05:41, 2F
→
06/29 05:41, , 3F
06/29 05:41, 3F
→
06/29 05:42, , 4F
06/29 05:42, 4F
推
06/29 09:20, , 5F
06/29 09:20, 5F
推
07/02 20:18, , 6F
07/02 20:18, 6F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 17 之 19 篇):