-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I think this project is good for group many pattern together, for beginers .
- Usually we already have some regex pattern, don't want to rewrite them
- Usually we need some build-in pattern, such as
\d,\s,\S,?. It is no need to write all easy pattern in crocs way, just plain regex string is easy understand.
Now, crocs would escape all
Line 29 in a7098ae
| return re.escape(self.value) |
For example:
x = X()
no_lf = P(E('\n'))
to_lf = T(no_lf, 1)
xplus = T(no_lf, 1)
xstar = T(no_lf, 0)
p1_ng = NG('project', to_lf)
p2_ng = NG('project', xplus)
project = Any(
P('(名称|编号)\s{0,5}(:|为)', p1_ng), # 1
P('test', p2,'test'), # 2
P('test《?', p2,'》?test'), # 3
)
re.findall(project.to_regex, xxx)
Here, 1 and 3 would not work.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels