简体   繁体   English

表示 YYYY-MM-DD~Sucess

[英]Expression for YYYY-MM-DD~Sucess

I have written regex for replacing some text我写了正则表达式来替换一些文本

x.ServiceLogStatus
    .replace(/Failed/g, "<div class='div1'>\Error</div>")
    .replace(/Match not found/g, "<div class='div1'>\Error</div>"));                    

I also want to add another replacement for the pattern.我还想为该模式添加另一个替代品。

YYYY-MM-DD 
YYYY-MM-DD~Success 

How it is possible?怎么可能?

Let say 2001-12-31 i need to replace that date with red color which is inside div.假设2001-12-31我需要用 div 内的红色替换那个日期。 Let say 2001-12-31~Success , i need to replace that date with red color which is inside div.假设2001-12-31~Success ,我需要用 div 内的红色替换该日期。

What should i do?我该怎么办?

我自己修好了

x.ServiceLogStatus = x.ServiceLogStatus.replace(/(\d+[-/]\d+[-/]\d+)/g, "<div class='div2'>\ $1</div>").replace(/(\d+[-/]\d+[-/]\d+)/g, "<div class='div4'>\ $1</div>").replace(/~Success/g, "<div class='div2'>\ ~Success</div>")); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM