[問題] 語法請教

看板RegExp (正規表示式 Regular Expression)作者 (我愛吃涼麵)時間15年前 (2009/11/22 19:18), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
請問下面這個 preg_match 的用法怎麼拆解? /** * Validate that a hostname (for example $_SERVER['HTTP_HOST']) is safe. * * As $_SERVER['HTTP_HOST'] is user input, ensure it only contains characters * allowed in hostnames. See RFC 952 (and RFC 2181). $_SERVER['HTTP_HOST'] is * lowercased. * * @return * TRUE if only containing valid characters, or FALSE otherwise. */ function drupal_valid_http_host($host) { return preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $host); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.132.186.59
文章代碼(AID): #1B2HtsFF (RegExp)
討論串 (同標題文章)
以下文章回應了本文
2
2
完整討論串 (本文為第 1 之 2 篇):
2
2
文章代碼(AID): #1B2HtsFF (RegExp)