我有一个文本字符串,我想检查该字符串是否包含某个模式。即 [Ref:number/number/number]
var myStr = "This is a string [Ref:1234/823/2]"; //Yes, has regex pattern
var myStr2 = "This is another sample string"; //No, regex pattern not present
任何想法该模式的正则表达式是:[Ref:1234/823/2]?
单词 Ref 将始终出现,后跟一个冒号,然后是由正斜杠分隔的 3 组数字,并将包含在方括号内。
[Ref:<digits>/<digits>/<digits>]
有任何想法吗?
慕妹3146593
幕布斯6054654
相关分类