es6如何利用正则表达式在字符串里找到指定值,下面web建站小编给大家详细介绍一下介绍正则表达式的运用方法!
match的运用
var string = "foo", exp = /oo/; var result = string.match(exp); console.log(result); //['oo', index: 1, input: 'foo', groups: undefined]
test的运用
var string = "foo", exp = /oo/; var result = exp.test(string); console.log(result); //true
search的运用
var string = "foo", exp = /oo/; var result = string.search(exp); console.log(result); // 1,搜索不到返回-1
上面是“es6如何利用正则表达式在字符串里找到指定值”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_3260.html
workflows工作流
一只巨大的古代乌龟后面建有一座城市的超现实场景
3d卡通风格多彩头发的女人
一只可爱的小鸟在飞翔ComfyUI工作流
一只可爱的飞鸟ComfyUI工作流
一座千年九尾白狐玉雕ComfyUI工作流
1个很漂亮的单身小女孩ComfyUI工作流
一头巨大的古代大象背后建着一座城市
一只蚊子被嵌在琥珀中ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!