In this lesson we'll learn shorthands for common character classes as well as their negated forms.

var str = `Afewserg, %8392 ?AWE`;

var regex = /[a-zA-Z0-9]/g;
// the same as:
var regex = /\w/g; // Find anything but not the a-zA-Z0-9
var regex = /[^a-zA-Z0-9]/g;
// the same as
var regex = /\W/g; var regex = /[0-9]/g;
// the same as:
var regex = /\d/g; // Find anything but not the 0-9
var regex = /[^0-9]/g;
// the same as
var regex = /\D/g; var regex = /\s/g; // match all the space // Find anything but not the space
var regex = /[^\s]/g;
// the same as:
var regex = /\S/g;

[Regex Expression] Use Shorthand to Find Common Sets of Characters的更多相关文章

  1. [Regex Expression] Find Sets of Characters

    Regular Expression Character Classes define a group of characters we can use in conjunction with qua ...

  2. Regex Expression的资料和笔记整理

    维基百科:http://en.wikipedia.org/wiki/Regular_expression 正则表达式在线测试:http://tool.chinaz.com/regex/ 正则表达式,常 ...

  3. boost regex expression

    Boost.Regex provides three different functions to search for regular expressions 1. regex_match #inc ...

  4. URL Regex expression

    转载: http://blog.csdn.net/weasleyqi/article/details/7912647 首先,正则表达式: String check = @"((http|ft ...

  5. [Regex Expression] Tagline --- {0, } {1,10}

    Using a character set repeated 1 or more times, make a pattern to search for strings that do not con ...

  6. [Regex Expression] Confirmative -- World bundry

    String to check: As it turns out, our potential shipmates are extremely superstitious. As such, we d ...

  7. [Regex Expression] Match mutli-line number, number range

    /^-?\d{,}\.\d+$/gm

  8. java Suspicious regex expression "." in call to 'replaceAll()' 问题延展

    因为要处理从身份证读取到的有效期时间,所以用到了replaceAll这个方法,类似如下代码: String s1 = s.replaceAll(".", "-" ...

  9. Android之字符串的拆分-split

    字符串的拆分可以利用android的 split 来简单实现 具体看如下代码: String s3 = "Real-How-To"; String [] temp = null; ...

随机推荐

  1. Nginx的安装及简单配置

    Nginx安装 1.下载相关组件 yum install -y gcc gcc-c++                                   #安装C/C++编译器 yum -y ins ...

  2. Eclipse 添加快捷方式

    1.在/usr/share/applications创建一个desktop文件,命名为eclipse.desktop 文件内容如下 [Desktop Entry]Name=EclipseType=Ap ...

  3. freemarker常用的基本命令

    freemarker包括下面几个基本命令 if,else,elseif指令switch,case,default,break指令list,break指令include指令import 指令nopars ...

  4. Flexbox属性查询列表

    1.任何一个flexbox布局的第一步是需要创建一个flex容器.为此给元素设置display属性的值为flex.在Safari浏览器中,你依然需要添加前缀-webkit. .flexcontaine ...

  5. C#程序调用cmd执行命令-MySql备份还原

    1.简单实例 //备份还原mysql public static void TestOne() { Process p = new Process(); p.StartInfo.FileName = ...

  6. .net web api 的route理解

    .NET web api 的特性是和MVC一样,通过Route 来控制action的访问方式.Route匹配规则是个奇特的方式,首先看一段Route的模板 Routes.MapHttpRoute( n ...

  7. 在eclipse中对于java的操作

    1. 新建project new project --> java project -->input the name of the project and choose the jre ...

  8. webstrom的注释

    今天我们小组的新同学有一个BUG调不好,然后我就帮他调一下.在调试的过程中非常累,纠其原因还是他注释写的不完善.我们可以看一下,他是这样写注释的(随便拿一个方法举例),如下图: 乍一看,是不是觉得他的 ...

  9. 3月23日html(五) 格式与布局练习:360浏览器布局

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> < ...

  10. Java学习笔记--注解

    注解的使用与实例:http://www.cnblogs.com/pepcod/archive/2013/02/16/2913474.html 注解的作用及使用方法:http://wenku.baidu ...