为了账号安全,请及时绑定邮箱和手机立即绑定

有正则高手吗? 帮忙解决一下这个问题

有正则高手吗? 帮忙解决一下这个问题

慕码人2483693 2018-12-19 15:15:48
现在有一条sql语句select ID as id,Name as name,IP as ip,lat,lon,0 as type from trk.devs_v2 where type=0 union all select id,signalName as name,ip ,lat,lng as lon,99 as type from yc_signal.signal union all想使用正则让最后一个union all去掉 而不是去掉所有的union all想要的结果为select ID as id,Name as name,IP as ip,lat,lon,0 as type from trk.devs_v2 where type=0 union all select id,signalName as name,ip,lat,lng as lon,99 as type from yc_signal.signal有正则大神帮帮忙呗! 万分感谢
查看完整描述

1 回答

?
幕布斯6054654

TA贡献1876条经验 获得超7个赞

let str = "union albdfdfdfunion alaadunion al";
let reg = str.replace(/(union al)$/,'');
console.log(reg)

查看完整回答
反对 回复 2019-01-01
  • 1 回答
  • 0 关注
  • 446 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号