Finding Plus Sign in Regular Expression

前端 未结 7 2309
陌清茗
陌清茗 2020-11-27 17:49
var string = \'abcd+1\';
var pattern = \'d+1\'
var reg = new RegExp(pattern,\'\');
alert(string.search(reg));

I found out last night that if you tr

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 18:39

    Easy way to make it :

    The alphabet is : "[\+]"

    All plus signs we want to find : "[\+]*"

提交回复
热议问题