正则表达式:任何不是字母或数字的字符 [英] Regular Expression: Any character that is NOT a letter or number
本文介绍了正则表达式:任何不是字母或数字的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在试图找出匹配任何不是字母或数字的字符的正则表达式。所以字符如(,, @,£,()等......
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 want to replace it with a blank space.
任何建议。
推荐答案
要匹配除字母或数字以外的任何内容,您可以尝试:
To match anything other than letter or number you could try this:
[^a-zA-Z0-9]
并替换:
var str = 'dfj,dsf7lfsd .sdklfj';
str = str.replace(/[^A-Za-z0-9]/g, ' ');
这篇关于正则表达式:任何不是字母或数字的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文