regex cheat sheet
regex pattern visualizer : regex101: build, test, and debug regex https://regex101.com/
regex
regex character
character | meaning |
---|---|
\d | digital characters |
\D | not digital characters |
\w | Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_]. |
\W | Matches any character that is not a word character from the basic Latin alphabet. Equivalent to [^A-Za-z0-9_]. |
\s | Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to [\f\n\r\t\v\u0020\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. For example, /\s\w*/ matches " bar" in "foo bar". |
\b | word boundary. "\baa\b.*" matches "aa bb", dose not match "aabb". |
look ahead and look behind
Lookaround | Name | What it Does |
---|---|---|
(?=foo) | Lookahead | Asserts that what immediately follows the current position in the string is foo |
(?<=foo) | Lookbehind | Asserts that what immediately precedes the current position in the string is foo |
(?!foo) | Negative Lookahead | Asserts that what immediately follows the current position in the string is not foo |
(?<!foo) | Negative Lookbehind | Asserts that what immediately precedes the current position in the string is not foo |
lazy vs greedy
type | pattern | description |
---|---|---|
greedy | .* | matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy) |
lazy | .*? | matches the previous token between zero and unlimited times, as few times as possible, expanding as needed (lazy) |
ref
Lookahead and Lookbehind Tutorial—Tips &Tricks
https://www.rexegg.com/regex-lookarounds.html
Regex Tutorial - Lookahead and Lookbehind Zero-Length Assertions
https://www.regular-expressions.info/lookaround.html
Regular expressions - JavaScript | MDN
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
Character classes - JavaScript | MDN
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
regex cheat sheet的更多相关文章
- XSS Filter Evasion Cheat Sheet 中文版
前言 译者注: 翻译本文的最初原因是当我自己看到这篇文章后,觉得它是非常有价值.但是这么著名的一个备忘录却一直没有人把它翻译成中文版.很多人仅仅是简单的把文中的 各种代码复制下来,然后看起来很刁的发在 ...
- [转]Blue Prism VBO Cheat Sheet
本文转自:https://www.cheatography.com/ethanium/cheat-sheets/blue-prism-vbo/ Blue Prism MAPIEx Configure ...
- Tools - 速查表与备忘单(Cheat Sheet)
Cheat Sheets Rico's cheatsheets Cheat-Sheets.org Python Python Cheat sheet Python Programming Cheat ...
- 转:PostgreSQL Cheat Sheet
PostgreSQL Cheat Sheet CREATE DATABASE CREATE DATABASE dbName; CREATE TABLE (with auto numbering int ...
- Git Cheat Sheet
Merge Undo git merge with conflicts $ git merge --abort Archive $ git archive --format zip --output ...
- CSS3 Animation Cheat Sheet:实用的 CSS3 动画库
CSS3 Animation Cheat Sheet 是一组预设的动画库,为您的 Web 项目添加各种很炫的动画.所有你需要做的是添加样式表到你的网站,为你想要添加动画效果的元素应用预制的 CSS 类 ...
- XSS (Cross Site Scripting) Prevention Cheat Sheet(XSS防护检查单)
本文是 XSS防御检查单的翻译版本 https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sh ...
- IOS Application Security Testing Cheat Sheet
IOS Application Security Testing Cheat Sheet [hide] 1 DRAFT CHEAT SHEET - WORK IN PROGRESS 2 Int ...
- HTML5 Cheat sheet PNG帮助手册(标签、事件、兼容)
HTML5 Cheat sheet PNG帮助手册(标签.事件.兼容) 1.HTML5标签 2.HTML5事件 3.HTML5兼容 最新HTML5手册资料请参考:http://www.inmotion ...
- [转]Swift Cheat Sheet
原文:http://kpbp.github.io/swiftcheatsheet/ A quick cheat sheet and reference guide for Apple's Swift ...
随机推荐
- TCP/IP协议(8): ICMP(Internet Control Message Protocol) 协议 ——诊断和控制 IP 协议层
TCP/IP协议(8): ICMP(Internet Control Message Protocol) 协议 --诊断和控制 IP 协议层 关于网际控制报文协议(Internet Control M ...
- Mac 创建Python3虚拟环境
Mac 创建Python3虚拟环境 1.安装virtualenv pip3 install virtualenv 安装virtualenvwrapper pip3 install virtualenv ...
- 内网安全之:Windows系统帐号隐藏
Windows系统帐号隐藏 目录 Windows系统帐号隐藏 1 CMD下创建隐藏账户 2 注册表创建隐藏账户 3 利用工具隐藏账户 1 CMD下创建隐藏账户 CMD下创建隐藏账户 net user ...
- Python连接Hadoop-impala方法
from impala.dbapi import connectfrom impala.util import as_pandas连接方式 conn1= connect(host='xxx.xxx.x ...
- postgresql 常用的删除重复数据方法
一. 最高效方法 测试环境验证,6600万行大表,删除2200万重复数据仅需3分钟 delete from deltest a where a.ctid = any(array (select cti ...
- linux系统下,添加硬盘并挂载到操作系统的shell 脚本范例
#!/bin/sh #新添加硬盘挂载到操作系统 pvcreate /dev/sdb / / 一般新添加硬盘都是识别为sdb,当然,也不一定,要具体情况具体分析. vgcreate datavg / ...
- Compiler25th005: Excel Compiler
Excel Compiler XCell Compiler, also known as Excel Compiler, offers very strong and hassle free Micr ...
- label 与input其中input的 id与name
<div> <label for="myfile">新头像 {% load static %} <img src="{% static 'i ...
- SAP VL02N 字段不允许编辑
METHOD if_ex_le_shp_delivery_proc~change_field_attributes. data: ls_field_attributes type shp_screen ...
- ansible 离线部署
1.安装 python 环境 wget https://mirrors.bfsu.edu.cn/anaconda/archive/Anaconda3-2022.10-Linux-x86_64.sh s ...