婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 知識(shí)庫(kù) > 一個(gè)正則表達(dá)式的看法(?:)

一個(gè)正則表達(dá)式的看法(?:)

熱門(mén)標(biāo)簽:上海銷(xiāo)售電銷(xiāo)機(jī)器人軟件 淄博市張店區(qū)地圖標(biāo)注 山東外呼系統(tǒng)聯(lián)系方式 自己做的電銷(xiāo)機(jī)器人 浙江營(yíng)銷(xiāo)外呼系統(tǒng)有哪些 惠安地圖標(biāo)注 哈爾濱公司外呼系統(tǒng)代理 地圖標(biāo)注店鋪地圖標(biāo)注酒店 遼寧秒客來(lái)電話(huà)機(jī)器人
原正則的出現(xiàn)是為了實(shí)現(xiàn)apache上傳目錄無(wú)執(zhí)行權(quán)限,不過(guò)大家知道在 windows下對(duì)于文件名是不區(qū)分大小寫(xiě)的,但在*unx下就不同了,其中st0p.php和st0p.Php是兩個(gè)不同的文件,所以此正則(?i:.php)出現(xiàn)
復(fù)制代碼 代碼如下:

Directory "/var/www/upload">
FilesMatch "(?i:.php)">
Order Allow,Deny
Deny from all
/FilesMatch>
/Directory>

kindle說(shuō)是參考http://perldoc.perl.org/perlre.html#Extended-Patterns的內(nèi)容進(jìn)行寫(xiě)的,具體的內(nèi)容大家自己看,我們說(shuō)一下關(guān)于此表達(dá)式的部分..

我們找到?:相關(guān)的部分,其用法有兩種(?:pattern)和(?imsx-imsx:pattern)
我們需要用的是后者,前者的話(huà)是沒(méi)法區(qū)分大小寫(xiě)的.而后者的用法就是(?標(biāo)志修飾符:格式)
其中原文中有一句話(huà)是Any letters between ? and : act as flags modifiers as with (?imsx-imsx).
這句話(huà)就說(shuō)明了imsx-imsx的作用,標(biāo)志修飾符
我們看一下剛才出現(xiàn)的正則(?i:.php)
?的作用是在默認(rèn)的貪婪模式下盡可能多的匹配所搜索的字符串,當(dāng)該字符緊跟在任何一個(gè)其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面時(shí),匹配模式是非貪婪的。非貪婪模式盡可能少的匹配所搜索的字符串,例如,對(duì)于字符串 "oooo",'o+?' 將匹配單個(gè) "o",而 'o+' 將匹配所有 'o'。

其中i的作用為忽略大小寫(xiě)
.php就是我們需要匹配的部分,由于?和i的作用,那我們的正則就會(huì)在不區(qū)分大小寫(xiě)的情況下盡可能多的匹配所搜索的字符串,這樣就達(dá)到了我們禁用所有.php后綴文件的訪問(wèn)了

當(dāng)然還有別的參數(shù),更多的內(nèi)容大家參考一下http://perldoc.perl.org/perlre.html#Extended-Patterns

m
Treat string as multiple lines. That is, change "^" and "$" from matching the start or end of the string to matching the start or end of any line anywhere within the string.

s
Treat string as single line. That is, change "." to match any character whatsoever, even a newline, which normally it would not match.
Used together, as /ms, they let the "." match any character whatsoever, while still allowing "^" and "$" to match, respectively, just after and just before newlines within the string.

i
Do case-insensitive pattern matching.
If use locale is in effect, the case map is taken from the current locale. See perllocale.

x
Extend your pattern's legibility by permitting whitespace and comments.

p
Preserve the string matched such that ${^PREMATCH}, ${^MATCH}, and ${^POSTMATCH} are available for use after matching.

g and c
Global matching, and keep the Current position after failed matching. Unlike i, m, s and x, these two flags affect the way the regex is used rather than the regex itself. See "Using regular expressions in Perl" in perlretut for further explanation of the g and c modifiers.

其中:應(yīng)該只是一個(gè)分隔符吧,不知道還有沒(méi)有別的作用,如果哪個(gè)大牛知道,請(qǐng)告訴我.

.php就是我們要匹配的部分了,從上面的圖我們..

標(biāo)簽:宣城 泰州 長(zhǎng)沙 銅川 西安 綿陽(yáng) 無(wú)錫 重慶

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《一個(gè)正則表達(dá)式的看法(?:)》,本文關(guān)鍵詞  一個(gè),正則,表達(dá)式,的,看法,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《一個(gè)正則表達(dá)式的看法(?:)》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于一個(gè)正則表達(dá)式的看法(?:)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 江达县| 肇东市| 周至县| 温州市| 泌阳县| 龙门县| 桑日县| 徐州市| 西昌市| 丹寨县| 巴楚县| 江北区| 博湖县| 盐山县| 汉中市| 湟源县| 高唐县| 侯马市| 阿勒泰市| 治县。| 长春市| 阿拉善左旗| 丁青县| 田阳县| 宁强县| 射阳县| 垦利县| 台东县| 庆安县| 五华县| 安岳县| 巴中市| 河北区| 乌苏市| 习水县| 开封县| 望都县| 渝北区| 子洲县| 丰县| 钦州市|