简体   繁体   English

字母数字字符和-/仅的正则表达式

[英]Regular Expression for Alphanumeric characters and - / only

Trying to work on a regular expression in javascript that allows alphanumeric characters excludes most unique characters except - / 尝试使用允许字母数字字符的javascript中的正则表达式来排除大多数唯一字符,但-/

validateDesc: function(desc) {
    var matches = /^[a-zA-Z\d\-_.,\s]+$/;
    return matches.test(desc);
}

The one above I've tried to make only allowing alphanumeric, what do I have to add to make that happen? 上面我试图只允许字母数字的那个,我必须添加些什么才能实现呢? If anyone could give any insight on how to add other unique characters as well that would be greatly appreciated. 如果有人能对如何添加其他唯一字符提供任何见解,也将不胜感激。

Regular expressions need delimiters. 正则表达式需要定界符。 And be sure to include / if you want that to match. 并且如果要匹配,请确保包含/

validateDesc: function(desc) {
  var matches = /^[a-zA-Z0-9\-_., \t\/]+$/;
  return matches.test(desc);
}

暂无
暂无

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

相关问题 JavaScript正则表达式(带_-的字母数字字符) - JavaScript regular expression ( alphanumeric characters with _-) JQuery正则表达式接受字母数字字符和&#39;, - - JQuery Regular expression to accept alphanumeric characters and ' , - JS 正则表达式 允许字母数字字符和。 , " ( ) - _ #: ; * @ &amp; 不剩余 +, =, $, ,, &lt;, &gt;, `, ~, {, }, |,\?,, ~ - JS regular expression Allow alphanumeric characters and . , " ( ) - _ # : ; * @ & not remaining +, =, $, !, <, >, `, ~, {, }, |,\,?, ~ javascript-正则表达式字母数字和特殊字符 - javascript- regular expression alphanumeric and special characters 正则表达式字母数字字符-允许连字符和下划线 - regular expression alphanumeric characters - allowing hyphens and underscores 如何修改正则表达式以仅测试出现在字母数字字符之前的字符串中的字符? - How can I modify my regular expression to test only the characters in a string that appear before alphanumeric characters appear? [字母数字] [字母数字.__ @] 31个字符的正则表达式建议 - Regular Expression advice for [Alphanumeric][alphanumeric.-_@] 31 characters 正则表达式仅适用于字符 - Regular expression for only characters 仅一个字符(*)或其他字母数字的正则表达式 - Regular Expression for only one character(*) or other alphanumeric 正则表达式,允许字母数字与空格并禁止某些特殊字符(&lt;&gt;&;) - Regular expression to allow alphanumeric with space and disallow certain special characters(<>&;)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM