关于replace替换指定位置的单词
有字符串
“LeftMessage is null and SentEmail is null and MetWith is null and SlsmanDist like 'KEE - kevin tang%”
先检索出有SlsmanDist这个单词,
如果有,将其前面的and改为OR,
其它的and不变,字符串长度是可变的
[解决办法]
var test = "LeftMessage is null and SentEmail is null and MetWith is null and SlsmanDist like 'KEE - kevin tang"; alert(test.replace(/and SlsmanDist/g, function() { return "or SlsmanDist"; }));
[解决办法]
var str="LeftMessage is null and SentEmail is null and MetWith is null and SlsmanDist like 'KEE - kevin tang%";alert(str.replace(/and\s+(SlsmanDist)/gi,"Or $1"))
[解决办法]
var str = "LeftMessage is null and SentEmail is null and MetWith is null and SlsmanDist";alert(str.replace(/\band\b(?=\s*\bSlsmanDist\b)/img,"OR"));
[解决办法]
看了上面几位,我不敢发言了...
[解决办法]