Skip to content

Instantly share code, notes, and snippets.

@notnotype
Last active April 14, 2021 02:23
Show Gist options
  • Save notnotype/65b0137d401dc09242bc9760bc3458ae to your computer and use it in GitHub Desktop.
Save notnotype/65b0137d401dc09242bc9760bc3458ae to your computer and use it in GitHub Desktop.
[常用正则表达式] 常用正则表达式 #regex #Python #JavaScript

常用正则表达式

匹配html tag

body
<\s*body\s*(?:\s*[^>/]+\s*)*>([\s\S]*)<\s*/\s*body\s*(?:\s*[^>/]+\s*)*>

<\s*[^>/]+\s*(?:\s*[^>/]+\s*)*>([\s\S]*)<\s*/\s*[^>/]+\s*(?:\s*[^>/]+\s*)*>

group & groups

  1. 如group()的参数为0或空,返回匹配全部文本;否则,则会返回匹配的对应的分组
  2. groups()匹配对象的方法,一次性获取所有的分组(不包括group(0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment