[Regex Expression] Use Shorthand to Find Common Sets of Characters
2016-02-01 03:22
423 查看
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] Find Sets of Characters
- STLport在vc6中的集成
- SDK Hello world(直接使用SDK封装)
- [Regular Expressions] Find Repeated Patterns
- 一个类有多个基类的内存布局
- openCV学习记录:滤镜:重影&暗调
- 写个测试程序看看磁盘映像文件中哪个扇区可以使用?
- 在服务中以当前用户身份启动一个程序
- curl详解
- [LeetCode] Read N Characters Given Read4 用Read4来读取N个字符
- Linux学习笔记之yum安装mysql5.7
- [Regular Expressions] Find Plain Text Patterns
- ubuntu14.04:php7+apache2+mysql
- 在类有成员变量的场景下, 按照虚表原理, 模拟虚函数实现
- Codeforce 题目621C Wet Shark and Flowers(期望)
- 一个简单的DBHelper
- 视频课程计划
- java 将微信录音amr转换为mp3格式
- 在 Windows 平台上运行 FreeRTOS 示例程序
- deep learning framework(不同的深度学习框架)