Regex to Match Symbols: !$%^&*()_+|~-=`{}[]:";'<>?,./

后端 未结 6 1852
无人共我
无人共我 2020-11-28 19:20

I\'m trying to create a Regex test in JavaScript that will test a string to contain any of these characters:

!$%^&am         


        
6条回答
  •  臣服心动
    2020-11-28 19:44

    Replace all latters from any language in 'A', and if you wish for example all digits to 0:

    return str.replace(/[^\s!-@[-`{-~]/g, "A").replace(/\d/g, "0");
    

?,./" id="ans_title" name="title">
提交回复
热议问题