利用正则判断是否以Welcome开头
let str = "Welcome to the web site building tutorial!";
let regex = /^Welcome/;
if (regex.test(str)) {
console.log("判断当前字符串是以web开头!");
} else {
console.log("判断当前字符串不以web开头!");
}
//输出结果:判断当前字符串是以web开头!
利用正则输出字符串部分内容
let str = "Welcome to the web site building tutorial!";
let regex = /^Welcome(.*)/;
let result = regex.exec(str);
if (result != null) {
console.log('输出:', result[0]); // 输出: Welcome to the web site building tutorial!
console.log('输出:', result[1]); // 输出: to the web site building tutorial!
}
上面是“javascript正则表达式实现字符串匹配输出”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_4502.html
workflows工作流
一个迷人的女人ComfyUI工作流
在森林中心有一座蛇形的房子ComfyUI工作流
梦幻向日葵ComfyUI工作流
乒乓卡通3d人物
基础扩图comfyui工作流
树上一个快乐的猕猴桃ComfyUI工作流
1个很漂亮的单身小女孩ComfyUI工作流
一个冰淇淋ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

iframe开发admin后台
canvas黑洞漩涡(canvas+js)
css3结合svg做一个动态广告
css3+js菜单点击动态效果
利用js+css3做一个小鱼游泳特效
一起去看流星雨(代码)
SVG路径动画效果
会议人员60s签到倒计时插件













