Skip to content

Commit

Permalink
regex
Browse files Browse the repository at this point in the history
  • Loading branch information
nealmind committed Aug 15, 2020
1 parent 330cee1 commit 2ece68d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions _posts/2020-08-15-regex-grammar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
layout: post
title: 正则表达式语法
tags: 正则表达式
author: neal

---
* content
{:toc}
dss

| 字符 | 描述 |
| ---- | ------------------------------------------------------------ |
| $ | **匹配结尾** 如果设置了 RegExp 对象的 Multiline 属性,则 $ 也匹配 '\n' 或 '\r'。要匹配 $ 字符本身,请使用 \$|
| () | **表示一个子表达式** |
| * | **匹配前面的子表达式0到多次** |
| + | **匹配前面的子表达式1到多次**`*` 注意区分 |
| . | **匹配除换行符 `\n` 之外的任意单个字符** 针对单个 |
| [] | **表达式,和`()`区别是 [] 只匹配单个字符** |
| ? | **匹配前面的子表达式0次或1次** 注意和 `*`,`+` 做区分 |
| \ | **转义符** |
| {} | **范围限定符,描述出现频率范围** 例如:ab{0,3} 表示 b最多出现3次,最少出现0次 |
| \| | **** |

0 comments on commit 2ece68d

Please sign in to comment.