About Cacher
Web App
Download
Sign In
Sign Up
menu
Cacher is the code snippet organizer for pro developers
We empower you and your team to get more done, faster
Learn More
jack-zheng
12/10/2018 - 1:41 PM
share
Share
add_circle_outline
Save
regex, python
regex, python
python regex.md
content_copy
file_download
Rendered
Source
其他语言 Java, 是什么处理 regex 的, 方法分配, 包结构
Java 中 regex 都在 'regex' package 下面, 主要的 class 是 Patter 和 Matcher
use Pattern to compile regex, and using matcher to process
there are mainly three method to deal with the match result
matches: attempt to match the entir region against the pattern, 一定要全部匹配
find: attempt to find the subsequence that match the pattern, 查找
lookAt: attempt to match from the start, no need entir match, 从头开始找匹配
API 的构成和 Python 基本是一致的, 可能互相之间都是有参考的吧
为什么 python 要用4个 method 来封装 regex?
我也不是很清楚, 应该就是应为这几个逻辑上都是独立的, 只不过我个人在使用 regex API 的时候习惯性的会把 matches 方法和 find 方法功能上做混淆
clear