Aunsiels / pyformlang

A python library to manipulate formal languages and various automata
https://pypi.org/project/pyformlang/
MIT License
43 stars 10 forks source link

Standard regular expression #1

Closed IlyaEp closed 4 years ago

IlyaEp commented 4 years ago

Hello,

I would like to use standard regular expressions along with the core functions of your library, such as building an automaton from a regular expression. How can i do this?

Thanks for pyformlang!

Aunsiels commented 4 years ago

Hi,

I am happy you like and use Pyformlang!

I wrote the wrapper PythonRegex: https://github.com/Aunsiels/pyformlang/blob/master/pyformlang/regular_expression/python_regex.py#L43. However, it does not contain all operations. You can access to:

For example:

PythonRegex("a[a-z]")
PythonRegex(r"a[\da]")

You can also give a regular expression directly to PythonRegex.

PythonRegex(re.compile("[a-e-g-z]*"))

You can check the tests for more examples: https://github.com/Aunsiels/pyformlang/blob/master/pyformlang/regular_expression/tests/test_python_regex.py

If you require additional operations, please let me know so I can consider adding them.