[Regex Expression] Use Shorthand to Find Common Sets of Characters
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的更多相关文章
- [Regex Expression] Find Sets of Characters
Regular Expression Character Classes define a group of characters we can use in conjunction with qua ...
- Regex Expression的资料和笔记整理
维基百科:http://en.wikipedia.org/wiki/Regular_expression 正则表达式在线测试:http://tool.chinaz.com/regex/ 正则表达式,常 ...
- boost regex expression
Boost.Regex provides three different functions to search for regular expressions 1. regex_match #inc ...
- URL Regex expression
转载: http://blog.csdn.net/weasleyqi/article/details/7912647 首先,正则表达式: String check = @"((http|ft ...
- [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 ...
- [Regex Expression] Confirmative -- World bundry
String to check: As it turns out, our potential shipmates are extremely superstitious. As such, we d ...
- [Regex Expression] Match mutli-line number, number range
/^-?\d{,}\.\d+$/gm
- java Suspicious regex expression "." in call to 'replaceAll()' 问题延展
因为要处理从身份证读取到的有效期时间,所以用到了replaceAll这个方法,类似如下代码: String s1 = s.replaceAll(".", "-" ...
- Android之字符串的拆分-split
字符串的拆分可以利用android的 split 来简单实现 具体看如下代码: String s3 = "Real-How-To"; String [] temp = null; ...
随机推荐
- Java基础知识强化54:经典排序之插入排序(InsertSort)
1. 插入排序原理图: 算法步骤: 1)将第一待排序序列第一个元素看做一个有序序列,把第二个元素到最后一个元素当成是未排序序列. 2)从头到尾依次扫描未排序序列,将扫描到的每个元素插入有序序列的适当位 ...
- (二)《Java编程思想》——t h i s 关键字
this 关键字(注意只能在方法内部使用)可为已调用了其方法的那个对象生成相应的句柄.可象对待其他任何对象句柄一样对待这个句柄. package chapter4; //: Leaf.java // ...
- (转)asp.net动态设置标题title 关键字keywords 描述descrtptions
方法一 if (!IsPostBack){//Page title网页标题Page.Title = “我的网站标题”;//须将网页head标签设成服务器控件模式,即<head runat=&qu ...
- 反射那些事儿——Java动态装载和反射技术
一直以来反射都是只闻其声,却无法将之使用,近日尽心下来学习下,发现了很多精妙之处. Java动态装载和反射技术 一.类的动态装载 1.Java代码编译和执行的整个过程包含了以下三个重要的机制: ● J ...
- SVN—patch的应用
svn 补丁的应用,在eclipse下有时候不能把全部变化加入,出现中文乱码问题.以下转载其他文章 原文地址:http://xiebh.iteye.com/blog/347458 1.create p ...
- iOS开发之17个常用代码整理
http://www.cnblogs.com/ios8/p/ios-17-code.html
- javascript 操作 css Rule
//add addCssRule('.bcd',{'color':'red','font-weight':'bold','font-size':'12px'},document.styleSheets ...
- grunt之入门实践
grunt 是基于nodejs的前端项目管理工具,凭借着大量优秀的插件从众多前端项目管理工具中脱颖而出. 确保先安装了nodejs 为了方便使用Grunt,应该在全局范围内安装Grunt的命令行接口( ...
- lib,dll区别 及 VS中如何添加lib,dll
1.加载lib/头文件 分两种方法: (1)适用于当前项目 第一步:项目->属性->C/C++->常规->附加包含目录(浏览.h文件的路径) 添加包含文件 第二步:项目-> ...
- Centos 6.x 系统下用yum安装Memcache
我们的第一步就是导入第三方软件仓库RPMForge ,首页进行centos 官网找到RPMForge下载地址 http://wiki.centos.org/AdditionalResources/Re ...