正则表达式 —— Cases 与 Tricks
1. cases
- 匹配任意单词(两侧可以有多个空格):
( +[a-zA-Z]+ +)
- 上述表达式无法匹配句子末尾的单词,若想匹配句尾或者逗号前的单词,则可拓展为:
( +[a-zA-Z]+[?,.]? +)- 中括号内的?表示问号这一标点,中括号后的?则表示匹配之前的项 1 次或 0 次;
- 匹配空行:
- windows:
^(\s*)\r\n - Linux:
^(\s*)\n
- windows:
- 匹配 ip:
[0-9]{1, 3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}
- 也可使用 [[:digit:]]表示数字:
[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}
- 也可使用 [[:digit:]]表示数字:
正则表达式 —— Cases 与 Tricks的更多相关文章
- 优雅编写Python3 的62个小贴士
iterable技巧 ▍1.创建一个数字序列(从0到10,间隔为2) >>> range(0,10,2)[0, 2, 4, 6, 8] ▍2.对一串数字求和(从0到10,间隔为2 ...
- 正则表达式 Tricks
*:0 或 多个 ?:任意一个 [list]:a[xyz]b,a 与 b 之间必须也只能有一个字符,但只能是 x/y/z,也即:axb, ayb, azb [!list]:匹配除 list 中的任意单 ...
- Matlab tips and tricks
matlab tips and tricks and ... page overview: I created this page as a vectorization helper but it g ...
- 【翻译】C# Tips & Tricks: Weak References - When and How to Use Them
原文:C# Tips & Tricks: Weak References - When and How to Use Them Sometimes you have an object whi ...
- Hex-Rays Decompiler Tips and tricks Volatile memory
https://www.hex-rays.com/products/decompiler/manual/tricks.shtml First of all, read the troubleshoot ...
- Tricks Device (hdu 5294 最短路+最大流)
Tricks Device Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) To ...
- Advanced Configuration Tricks
Advanced Configuration Tricks Configuration of zend-mvc applications happens in several steps: Initi ...
- 45 Useful JavaScript Tips, Tricks and Best Practices(有用的JavaScript技巧,技巧和最佳实践)
As you know, JavaScript is the number one programming language in the world, the language of the web ...
- 转:45 Useful JavaScript Tips, Tricks and Best Practices
原文来自于:http://flippinawesome.org/2013/12/23/45-useful-javascript-tips-tricks-and-best-practices/ 1 – ...
随机推荐
- CP-ABE的使用
参考: http://acsc.cs.utexas.edu/cpabe/tutorial.html http://acsc.cs.utexas.edu/cpabe/ 事先先配置好cp-abe:http ...
- [LeetCode] 95. Unique Binary Search Trees II(给定一个数字n,返回所有二叉搜索树) ☆☆☆
Unique Binary Search Trees II leetcode java [LeetCode]Unique Binary Search Trees II 异构二叉查找树II Unique ...
- vue cli搭建的vue项目 不小心开了eslint 一直报黄色的警告
报错必须处理,警告也忍不了,发现在bulid -webpack.base.config.js 里找到 const createLintingRule = () => ({ /*test: /\. ...
- Utf-8+Bom编码导致的读取数据部分异常问题
项目中经常会有这种场景,在配置文件中配置对应关系,项目启动的时候从中读取数据存入map缓存起来,这样使用的时候就可以直接从map找到对应的映射关系. 然后遇到了这么一个诡异的问题,一个简单的映射关系如 ...
- 【基础】火狐和谷歌在Selenium3.0上的启动(二)
参考地址:http://www.cnblogs.com/fnng/p/5932224.html https://github.com/mozilla/geckodriver [火狐浏览器] 火狐浏览器 ...
- laravel中当使用Elquent ORM中的模型作为参数进行传递时的方法:
Controller中的函数: /* $modelArg:是调用模型的路径,以字符串的形式传递过来. $id:要查询当前模型的id号. $args:具体查询的字段 */ public function ...
- learning ddr Electrical Characteristics and AC Timing
reference: JEDS79-3F.pdf , page:181
- Android 音视频深入 二 AudioTrack播放pcm(附源码下载)
本篇项目地址,名字是录音和播放PCM,求starhttps://github.com/979451341/Audio-and-video-learning-materials 1.AudioTrack ...
- python 笔记数据类型
python基础: 采用缩进方式 4个空格的缩进 大小写敏感 数据类型和变量 数据类型 计算机顾名思义就是可以做数学计算的机器,因此,计算机程序理所当然地可以处理各种数值,但是,计算机能处理的 ...
- bzoj2440
题解: 莫比乌斯反演 ans=sigma(x/(i*i)*miu[i]) 代码: #include<bits/stdc++.h> using namespace std; ; int T, ...