哪位高手能给举例说明一下修饰符y的用途,举个简单的例子详细说明一下
解决方案 »
- 关于JSP表单提交问题,至于具体专业术语怎么说我也不太清楚,嘿嘿,有空的大侠帮忙看看,谢谢!
- 关于模版中使用弹出式菜单的问题
- 表格中,點擊按鈕時,將選中復選框前的序號值附給一個自定義數組
- 如何在JS程序中停一些时间再往下执行?
- JS利用xmlDOM怎么做这样的表单自动填写?
- 急,求怎么样可以同时关闭N个窗口?在线等!
- 去特定长度的字符串问题
- 如何给<object ...></object>赋值?
- 在JAVASCRIPT中如何得到一个网页的内容?ActiveXObject ("Microsoft.XMLHTTP")不在考虑之列.
- 问各位一个有关jsp页面,浏览器后退时的问题!
- js保存图片到指定文件夹
- 正则表达式 /()??/什么意思
s 表示单选匹配
m 表示多行匹配木有见过y表示神马意思
y只能说明匹配字母y而已
sticky; matches only from the index indicated by the lastIndex property of this regular expression in the target string (and does not attempt to match from any later indexes). This allows the match-only-at-start capabilities of the character "^" to effectively be used at any location in a string by changing the value of the lastIndex property.
function print(str){
document.write(str);
document.write("<br/>");
}
var text = "First line\nsecond line";
var regex = /(\S+) line\n?/y;
var match = regex.exec(text);
print(match[1]); // prints "First"
print(regex.lastIndex); // prints 11
var match2 = regex.exec(text);
print(match2[1]); // prints "Second"
print(regex.lastIndex); // prints "22"
var match3 = regex.exec(text);
print(match3 === null); // prints "true"