A simple Python regular expression library.
You may want to install this package, if so, please follow the instructions below:
Change the working directory to the package folder(such as pyre0.2.1
),
then type the following command in terminal:
sudo python setup.py install
Open cmd(use shortcut key Win
+R
or open Start
menu, type cmd
in
Run
), then change the current directory to the package folder(such as
pyre0.2.1
), and type the following command in cmd:
python setup.py install
Try to change the current directory to the package folder(such as
pyre0.2.1
) in the command line tool and type
python setup.py install
If it doesn't work, report to me if you'd like.
In total, syntax supported by the library is the most basic ones. As following described in detail:
-
selection:
a|b
-
concatenation:
ab
-
loop:
a*
-
\
: escape. To indicate backslash itself, use\\
instead. -
\e
: epsilon. -
|
: selection. To indicate vertical bar, use\|
instead. -
*
: loop. To indicate star, use\*
instead. -
(
and)
: group. To indicate parentheses, use\(
and\)
instead.
I strongly recommend you use the provided functions and constants rather than writing literally.
I have several good reasons for this. First, the code will be more easy to read. Even some one who hasn't learnt the syntax can read your code. Second, I am considering expand the syntax, and then I can optimize for effeciency in the provided functions. Third, maybe some day I consider the syntax ugly and then changed it, if you only use the provided functions, you don't need to change a simgle line of your code.
You should NOT copy it to complete your homework.