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. 〖转〗request.getparameter()和request.getAttribute()的区别

    getAttribute表示从request范围取得设置的属性,必须要先setAttribute设置属性,才能通过getAttribute来取得,设置与取得的为Object对象类型 getParame ...

  2. Java基础知识强化45:StringBuffer类之字符串反转的案例

    1. 案例演示: package cn.itcast_07; import java.util.Scanner; /* * 把字符串反转 */ public class StringBufferTes ...

  3. DC综合环境的一些概念

    DC综合环境的一些概念 启动文件 .synopsys_dc_setup 采用Tcl格式,包含工艺库的路径信息和其他环境变量 不同位置启动顺序 1.Synopsys安装目录 2.用户家目录 3.项目工作 ...

  4. Java多线程练习

    国际惯例,先贴出代码 package jiankong; import java.util.Date; public class jiankong { public static void main( ...

  5. 浅述Oracle分布式事务概念

    着系统的复杂性不断增加,我们所面对的分布式系统渐渐增加.分布式文件系统.分布式消息队列系统等等层出不穷,在一些行业特别是互联网行业应用广泛.分布式数据库也是目前使用比较常用的分布式系统之一. 简单来说 ...

  6. 《第一行代码》学习笔记38-服务Service(5)

    1.希望服务一旦启动就立刻去执行某个动作,可以将逻辑写在onStartCommand()方法里. 2.onCreate()和onStartCommand()的区别:onCreate()方法是在服务第一 ...

  7. Flex布局摆脱float带来的布局问题

    完整文章地址http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html?utm_source=tuicool 使用浮动(float)的一个比较疑惑 ...

  8. poj2932 Coneology (扫描线)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Coneology Time Limit: 5000MS   Memory Lim ...

  9. javaScript中将时间戳转换成日期格式

    function DateFormt(time, format) { ); var o = { , "d+": testDate.getDate(), "h+" ...

  10. 实际工作中遇到的一些css

    1.除去table默认的每个单元格带有的类似内边距的空白如设置了table和td的border后,是这个样子:,设置<table cellspacing="0" >后变 ...