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

最新文章

  1. jenkins,dns错误log过大
  2. php大力力 [055节] 大力力阅读文章集锦
  3. Linux之重定向
  4. Android Touch消息传递机制探究分析
  5. 分布式环境下Unique ID生成方法
  6. lib和dll文件的区别和联系
  7. WPF 3D 小小小小引擎 - &#183;WPF 3D变换应用
  8. 第一个Delphi小程序
  9. 【Android Demo】通过WebService获取今日天气情况--转
  10. C#中的逆变和协变
  11. ssh自学笔记
  12. [20160711][在Windows下调用neven链接库]
  13. php里进程创建和分析
  14. 论JavaScript的作用域
  15. iptables 配置说明
  16. linux上安装完torch后仍报错:ImportError: No module named torch
  17. State management(状态管理)
  18. Atitit 常见每日流程日程日常工作.docx v4
  19. VS中常用快捷键
  20. Two Sum III - Data structure design LT170

热门文章

  1. JZOJ 5354. 【NOIP2017提高A组模拟9.9】导弹拦截
  2. tensorflow读书笔记
  3. 利用CRT配合VBS脚本实现自动化巡检
  4. NameError: name &#39;_name_&#39; is not defined
  5. LeetCode-1145 二叉树着色游戏
  6. Sidecar-详解 JuiceFS CSI Driver 新模式
  7. go常见的坑
  8. docker 安装 jFrog
  9. 并发JUC
  10. 2023 年 CCF 春季测试赛模拟赛 - 2 题解