博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Regular Expression Patterns
阅读量:4345 次
发布时间:2019-06-07

本文共 1047 字,大约阅读时间需要 3 分钟。

Regular Expression Patterns

Following lists the regular expression syntax that is available in Python.

Pattern Description
^ match beginning of the line.
$ match end of line.
. match any single character except '\n'.
[...] match any single character in brackets.
re* match 0 or more occurrences of preceding expression
re+ match 1 or more occurrences of preceding expression
re? match 0 or 1 occurrence of preceding expression.
re{n} match exactly n number of occurrences of preceding expression.
\1...\9 match n-th grouped sub-expression.
(re) Groups regular expressions and remembers matched text.

Examples

# \
) or [text](url "title")LINK_RE = NOIMG + BRK + \ r'''\(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12\s*)?\)'''# ![alttxt](http://x.com/) or ![alttxt](
)IMAGE_LINK_RE = r'\!' + BRK + r'\s*\(\s*(<.*?>|([^"\)\s]+\s*"[^"]*"|[^\)\s]*))\s*\)'# [Google][3]REFERENCE_RE = NOIMG + BRK + r'\s?\[([^\]]*)\]'# [Google]SHORT_REF_RE = NOIMG + r'\[([^\]]+)\]'

转载于:https://www.cnblogs.com/ZJUT-jiangnan/p/6381267.html

你可能感兴趣的文章
MySQL 处理重复数据
查看>>
关于typedef的用法总结(转)
查看>>
Linux下安装rabbitmq
查看>>
曹德旺
查看>>
【转】判断点在多边形内(matlab)
查看>>
java基础之集合:List Set Map的概述以及使用场景
查看>>
Python 线程 进程 协程
查看>>
iOS语言中的KVO机制
查看>>
excel第一次打开报错 向程序发送命令时出错 多种解决办法含终极解决方法
查看>>
响应式web设计之CSS3 Media Queries
查看>>
实验三
查看>>
机器码和字节码
查看>>
环形菜单的实现
查看>>
【解决Chrome浏览器和IE浏览器上传附件兼容的问题 -- Chrome关闭flash后,uploadify插件不可用的解决办法】...
查看>>
34 帧动画
查看>>
二次剩余及欧拉准则
查看>>
thymeleaf 自定义标签
查看>>
关于WordCount的作业
查看>>
UIView的layoutSubviews,initWithFrame,initWithCoder方法
查看>>
STM32+IAP方案 实现网络升级应用固件
查看>>