<html>
<head>
</head>
<body>
<input id="test" type="text" value="" />
<input id="test" type="text" value="" />
<input id="test" type="text" value="" />
<input id="test" type="text" value="" />
<input id="test" type="text" value="" />
<script>
var testStr = "windows 95"
/* 1 - 不带子表达式匹配 */
var testReg = /^windows .*$/
var result = testStr.match(testReg);
console.log("/^windows .*$/="+result) // /^windows .*$/=windows 95
/* 2 - 带子表达式匹配 */
var testReg = /^windows (.*)$/
var result = testStr.match(testReg);
console.log("/^windows (.*)$/="+result) // /^windows (.*)$/=windows 95,95
/* 3 - 带子表达式,不记录其匹配结果 */
var testReg = /^windows (?:.*)$/
var result = testStr.match(testReg);
console.log("/^windows (?:.*)$/="+result) // /^windows (?:.*)$/=windows 95
/* 4 - 前瞻匹配,匹配位置,正匹配 */
var testReg = /^windows (?=95)95$/
var result = testStr.match(testReg);
console.log("/^windows (?=.*)$/="+result) // /^windows (?=.*)$/=windows 95
/* 5 - 前瞻匹配,匹配位置,负匹配 */
var testStr = "windows me"
var testReg = /^windows (?!95)me$/
var result = testStr.match(testReg);
console.log("/^windows (?!\d*)$/="+result) // /^windows (?!d*)$/=windows me
</script>
</body>
</html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有