简体   繁体   English

允许字母数字、特殊字符和空格的正则表达式

[英]Regex for allowing alphanumeric, special characters and space

I am searching for a regular expression for allowing alphanumeric characters, special characters (-_'àâçèéêîôùûÀÈÙÇÉ), or spaces in the middle in JavaScript.我正在搜索允许字母数字字符、特殊字符 (-_'àâçèéêîôùûÀÈÙÇÉ) 或 JavaScript 中间空格的正则表达式。 I tried Googling but wasn't able to find that.我尝试谷歌搜索,但无法找到。

Can anyone help me out with this?谁能帮我解决这个问题?

Thanks in advance.提前致谢。

You can try something like this:你可以尝试这样的事情:

([\d\w\-'àâçèéêîôùûÀÈÙÇÉ])([\d\w\-' àâçèéêîôùûÀÈÙÇÉ][\d\w\-'àâçèéêîôùûÀÈÙÇÉ]+)*

Check this expression on https://regexr.com/检查https://regexr.com/上的这个表达式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM