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的更多相关文章

  1. XSS Filter Evasion Cheat Sheet 中文版

    前言 译者注: 翻译本文的最初原因是当我自己看到这篇文章后,觉得它是非常有价值.但是这么著名的一个备忘录却一直没有人把它翻译成中文版.很多人仅仅是简单的把文中的 各种代码复制下来,然后看起来很刁的发在 ...

  2. [转]Blue Prism VBO Cheat Sheet

    本文转自:https://www.cheatography.com/ethanium/cheat-sheets/blue-prism-vbo/ Blue Prism MAPIEx Configure ...

  3. Tools - 速查表与备忘单(Cheat Sheet)

    Cheat Sheets Rico's cheatsheets Cheat-Sheets.org Python Python Cheat sheet Python Programming Cheat ...

  4. 转:PostgreSQL Cheat Sheet

    PostgreSQL Cheat Sheet CREATE DATABASE CREATE DATABASE dbName; CREATE TABLE (with auto numbering int ...

  5. Git Cheat Sheet

    Merge Undo git merge with conflicts $ git merge --abort Archive $ git archive --format zip --output ...

  6. CSS3 Animation Cheat Sheet:实用的 CSS3 动画库

    CSS3 Animation Cheat Sheet 是一组预设的动画库,为您的 Web 项目添加各种很炫的动画.所有你需要做的是添加样式表到你的网站,为你想要添加动画效果的元素应用预制的 CSS 类 ...

  7. XSS (Cross Site Scripting) Prevention Cheat Sheet(XSS防护检查单)

    本文是 XSS防御检查单的翻译版本 https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sh ...

  8. IOS Application Security Testing Cheat Sheet

    IOS Application Security Testing Cheat Sheet    [hide]  1 DRAFT CHEAT SHEET - WORK IN PROGRESS 2 Int ...

  9. HTML5 Cheat sheet PNG帮助手册(标签、事件、兼容)

    HTML5 Cheat sheet PNG帮助手册(标签.事件.兼容) 1.HTML5标签 2.HTML5事件 3.HTML5兼容 最新HTML5手册资料请参考:http://www.inmotion ...

  10. [转]Swift Cheat Sheet

    原文:http://kpbp.github.io/swiftcheatsheet/ A quick cheat sheet and reference guide for Apple's Swift ...

随机推荐

  1. 郁金香 注入DLL代码 与MFC窗口DLL文件 开源

    10/10号更新 DLL注入器注入DLL卡死 问题 新增打开控制台 将阳光输出到控制台中 注入DLL代码 1 #include <stdio.h> 2 #include<Window ...

  2. 轻量级CI/CD发布部署环境搭建及使用_01_基本介绍

    轻量级CI/CD发布部署环境搭建及使用_01_基本介绍 授人以鱼不如授人以渔,如果说的别人都没明白,说明自己实际也不是太明白 最终实现效果如图 1,选择相应环境下的项目,执行构建 注: web:vue ...

  3. VM中centos7创建后无法上网问题

    在VMware 12 Pro上安装完CentOS7发现使用ping www.baidu.com无法ping通 使用以下命令: 1.cd /etc/sysconfig/network-scripts 然 ...

  4. JavaWeb中的Servlet

    Servlet 目录 Servlet 一.互联网中的资源 二.Servlet 2.1.Servlet的作用 2.2.Servlet执行流程 2.3.Servlet生命周期 2.4.Servlet的继承 ...

  5. vue3中对于/deep/和::v-deep的警告信息处理

    目前发现两处警告信息: ::v-deep usage as a combinator has been deprecated. Use :deep() instead. the >>> ...

  6. 自定义一个JdbcTemplate(增删改数据库中表记录)

    需求: 自定义一个JdbcTemplate模板,实现增删改数据库中表记录的功能 1 package demo03; 2 3 import utils.JDBC_DBCP_Utils; 4 5 impo ...

  7. vue3 、typescript环境, props自定义类型propType

    vue3 .typescript环境, props自定义类型propType //子组件的props类型是复杂的类型的时候,可以用propType进行强制类型转换 //eg 复杂函数,对象数组,对象的 ...

  8. 函数:3ds max 给选择对象设置轴心点

    ------轴心点函数大全------函数名称中的字母含义:------w:西 e:东 n:北 s:南 b:底 c:中心 t:顶 m:间 如:wnb表示西北下 smt表示南中上 fn pivot_wn ...

  9. springboot上传文件失败:The temporary upload location [/tmp/tomcat.7112002115745457830.8765/work/Tomcat/localhost/ROOT] is not valid

    字面意思就是上传的临时目录不存在,问题就是linux系统会自动清理tmp目录下超过10天没有任何操作的目录或文件 解决办法 1.重启springboot服务,当然这只是暂时的,下次隔太久一样会失效 2 ...

  10. linux查看java堆栈信息_linux进程堆栈大小

    1.查看JAVA进程JVM参数 jinfo -flags pid(进程号) -XX:CICompilerCount=2 最大的并行编译数 -XX:InitialHeapSize=16777216 JV ...