开发者

jquery multi match

开发者 https://www.devze.com 2023-03-28 01:44 出处:网络
How to do a multi match in jquery? match id = a 开发者_C百科+ num + b + num or id = a + num + c + num(num range from 1-99)? Thanks.

How to do a multi match in jquery? match id = a 开发者_C百科+ num + b + num or id = a + num + c + num(num range from 1-99)? Thanks.

if($(this).attr("id").match(/^a\d{1,2}b\d{1,2}$/), $(this).attr("id").match(/^a\d{1,2}c\d{1,2}$/)) 
//only work the last match


Could you just put an or in your regex -

if($(this).attr("id").match(/^a\d{1,2}b\d{1,2}$|^a\d{1,2}c\d{1,2}$/)) 
0

精彩评论

暂无评论...
验证码 换一张
取 消