最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JS 正則表達(dá)式的位置匹配

 更新時(shí)間:2009年12月04日 12:35:51   作者:  
JS中正則表達(dá)式的位置匹配代碼,國(guó)外翻譯的文章。

http://regexpal.com/

上面這個(gè)網(wǎng)站可以用于在線檢測(cè)JS的正則表達(dá)式語(yǔ)法

除了熟知的幾個(gè)固定字符表示位置:

^ : Match the beginning of the string and, in multiline searches, the beginning of a line.

$ : Match the end of the string and, in multiline searches, the end of a line.

\b: 

Match a word boundary. That is, match the position between a \w character and a \W character or between a \w character and the beginning or end of a string. (Note, however, that [\b] matches backspace.)

\B: Match a position that is not a word boundary.

還有的就是使用正則表達(dá)式來(lái)確定要匹配的位置,也叫做Zero-Width Test(零寬斷言)

(?=p) :

A positive lookahead assertion. Require that the following characters match the pattern p, but do not include those characters in the match.

(?!p) :

A negative lookahead assertion. Require that the following characters do not match the pattern p.

對(duì)于(?=p)和(?!p)的使用舉一個(gè)例子:

要在url(skins/default/images/index/default.png)中匹配"/default/"中的"default",而不匹配"/default.png"中的"default"?

正則表達(dá)式: (?!\/)default(?=\/)

其中(?!\/)表示以"/"開(kāi)頭,(?=\/)表示以"/"結(jié)尾

相關(guān)文章

最新評(píng)論

许昌县| 甘泉县| 贵阳市| 保靖县| 阳原县| 龙岩市| 澄迈县| 华亭县| 临汾市| 五河县| 仙桃市| 营山县| 宁南县| 韶山市| 三明市| 阳山县| 恩平市| 合川市| 随州市| 苏尼特左旗| 嘉鱼县| 广东省| 太原市| 伊春市| 亳州市| 巴彦淖尔市| 仪征市| 麻城市| 阳泉市| 习水县| 集贤县| 富锦市| 海兴县| 徐闻县| 仲巴县| 无为县| 兴国县| 兰州市| 常熟市| 全州县| 富川|