Regular Expression: Any character that is NOT a letter or number

前端 未结 9 875
花落未央
花落未央 2020-12-07 19:32

I\'m trying to figure out the regular expression that will match any character that is not a letter or a number. So characters such as (,,@,£,() etc ...

Once found I

9条回答
  •  孤城傲影
    2020-12-07 20:07

    try doing str.replace(/[^\w]/); It will replace all the non-alphabets and numbers from your string!

    Edit 1: str.replace(/[^\w]/g, ' ')

提交回复
热议问题