[請益] 判斷某站網址的正規表達式

看板RegExp作者 (克里斯)時間16年前 (2007/11/25 22:32), 編輯推噓2(200)
留言2則, 2人參與, 最新討論串1/1
目前已知 filefront.com 的檔案網址有兩種格式 如下 http://files.filefront.com/DreamWeaverexe/;9096184;/fileinfo.html http://files.filefront.com/9096184 其中 9096184 必然為7碼數字 DreamWeaverexe 為不定長度字串 謝謝各位的指導 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.195.75.159

11/25 22:37, , 1F
抓 domain 後的 / 字串, 全數字是第二種, 其他第一種
11/25 22:37, 1F

11/25 23:14, , 2F
當然這是賭DreamWeaverexe不會是7碼數字就是了,贏面滿大的。
11/25 23:14, 2F
寫出來像這樣 http://files.filefront.com/ \w* (?:/;)? \d{7} (?:;/fileinfo.html)? ※ 編輯: chrisdar 來自: 163.23.17.131 (11/27 15:03)
文章代碼(AID): #17IOUL6Q (RegExp)