[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; ...
随机推荐
- Python进阶之路---1.5python数据类型-字符串
字符串 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; ...
- Android/Linux boot time优化
基于analyze_boot.py分析Android/Linux的kernel boot时间 1.修改HiKey的BoardConfig.mk文件,使能initcall_debug,增加dmesg b ...
- Universal-Image-Loader 示例 工具
Base public class MyApplication extends Application { @Override public void onCreate() { ...
- SignalR2.0开发实例之——设置时间、后台其他地方使用集线器、使用自己的连接ID
一.连接的生命周期设置: 如下: // 该值表示连接在超时之前保持打开状态的时间长度. //默认为110秒 GlobalHost.Configuration.ConnectionTimeout = T ...
- dbutils的使用Demo
首先了解一下 Queryrunner.query —————只可以执行select语句. Queryrunner.update —————只可以接收update,delte,insert语句 ...
- [Android分享] 如何解决Android 5.0中出现的警告:Service Intent must be explicit
Android 5.0程序运行报Service Intent must be explicit错误,原因是5.0的service必须显式调用 改成 Intent intent = new Intent ...
- 利用redis协助mysql数据库搬迁
最近公司新项目上线,需要数据库搬迁,但新版本和老版本数据库差距比较大,关系也比较复杂.如果用传统办法,需要撰写很多mysql脚本,工程量虽然不大,但对于没有dba的公司来说,稍微有点难度.本人就勉为其 ...
- k-means均值聚类算法(转)
4.1.摘要 在前面的文章中,介绍了三种常见的分类算法.分类作为一种监督学习方法,要求必须事先明确知道各个类别的信息,并且断言所有待分类项都有一个类别与之对应.但是很多时候上述条件得不到满足,尤其是在 ...
- sql delete output
select * into #student1 from student select * from #student1 create table #temp2( id int not null,na ...
- iOS 第三方 需要 引用的库
================================================== AFNetWorking 是基于 nsurlconnection 所以不需要引入库 === ...