iogf / crocs Goto Github PK
View Code? Open in Web Editor NEWPython to Regex. Regex to Python. The yRegex for humans.
License: Apache License 2.0
Python to Regex. Regex to Python. The yRegex for humans.
License: Apache License 2.0
I think this project is good for group many pattern together, for beginers .
\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
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.
Hi,
love the work you've done here.
I've tried to play with it a little bit, creating the regex and passing it to the re module.
The only way I've found to do it is to use the seed function like this:
from crocs import *
import re
g = Group('X',Times(Include(Seq('0', '9')), 1, 2))
e = Pattern(g, Times(Include(Seq('a', 'z')), 1, 3), g)
regex_str = e.seed()[0]
re.findall(regex_str, "X6zX6")
it this the official way to do it? I couldn't find any indication in the wiki about this. Wouldn't a property be more appropriate to access it, something like e.regex or similar?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.