Exrex - Irregular Methods On Regular Expressions
Monday, September 23, 2019
Edit
Exrex - Irregular Methods On Regular Expressions - Hi friends mederc, In the article that you read this time with the title Exrex - Irregular Methods On Regular Expressions, We have prepared this article well for you to read and retrieve information from it. hopefully fill the posts
Article Command Line,
Article Exrex,
Article Linux,
Article Mac,
Article Python,
Article Regular Expressions,
Article Windows, we write this you can understand. Alright, happy reading.
Title : Exrex - Irregular Methods On Regular Expressions
link : Exrex - Irregular Methods On Regular Expressions
Features
Installation
To install exrex, simply:
or
Usage
as python module
Command work usage
http://exrex.readthedocs.org/en/latest/
Fun/arts
Similar projects
Tools that generate a listing of all possible strings that check a given pattern:
Profiling
You are now reading the article Exrex - Irregular Methods On Regular Expressions with the link address https://mederc.blogspot.com/2019/09/exrex-irregular-methods-on-regular.html
Title : Exrex - Irregular Methods On Regular Expressions
link : Exrex - Irregular Methods On Regular Expressions
Exrex - Irregular Methods On Regular Expressions
Exrex is a command line tool too python module that generates all - or random - matching strings to a given regular aspect too more. It's pure python, without external dependencies.
There are regular expressions alongside interplanetary space matching strings (eg.:
[a-z]+
), inwards these cases exrex limits the maximum length of the interplanetary space parts. Exrex uses generators, too then the retention usage does non depend on the break of matching strings.
Features
- Generating all matching strings
- Generating a random matching string
- Counting the break of matching strings
- Simplification of regular expressions
Installation
To install exrex, simply:
$ pip install exrex
$ easy_install exrex
Usage
as python module
>>> import exrex >>> exrex.getone('(ex)r\\1') 'exrex' >>> list(exrex.generate('((hai){2}|world!)')) ['haihai', 'world!'] >>> exrex.getone('\d{4}-\d{4}-\d{4}-[0-9]{4}') '3096-7886-2834-5671' >>> exrex.getone('(1[0-2]|0[1-9])(:[0-5]\d){2} (A|P)M') '09:31:40 AM' >>> exrex.count('[01]{0,9}') 1023 >>> impress '\n'.join(exrex.generate('This is (a (code|cake|test)|an (apple|elf|output))\.')) This is a code. This is a cake. This is a test. This is an apple. This is an elf. This is an output. >>> impress exrex.simplify('(ab|ac|ad)') (a[bcd])
Command work usage
> exrex --help usage: exrex.py [-h] [-o FILE] [-l] [-d DELIMITER] [-v] REGEX exrex - regular aspect string generator positional arguments: REGEX REGEX string optional arguments: -h, --help present this assistance message too choke -o FILE, --output FILE Output file - default is STDOUT -l N, --limit northward Max bound for arrive at size - default is twenty -c, --count Count matching strings -m N, --max-number northward Max break of strings - default is -1 -r, --random Returns a random string that matches to the regex -s, --simplify Simplifies a regular aspect -d DELIMITER, --delimiter DELIMITER Delimiter - default is \n -v, --verbose Verbose mode
Examples:$ exrex '[asdfg]' a second d f g $ exrex -r '(0[1-9]|1[012])-\d{2}' 09-85 $ exrex '[01]{10}' -c 1024
Documentationhttp://exrex.readthedocs.org/en/latest/
Fun/arts
- Boat:
exrex '( {20}(\| *\\|-{22}|\|)|\.={50}| ( ){0,5}\\\.| {12} {39})'
- Eyes:
exrex '(o|O|0)(_)(o|O|0)'
Similar projects
Tools that generate a listing of all possible strings that check a given pattern:
- regldg (features a alive demo on the website)
- regex-genex (supports using multiple regex patterns simultaneously)
- randexp.js (features several alive demos on the website)
- rstr.xeger (a method of the
rstr
Python module)
Profiling
python -m cProfile exrex.py '[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]' -o /dev/null
python -m cProfile exrex.py '[0-9]{6}' -o /dev/null
Thus the article Exrex - Irregular Methods On Regular Expressions
That's all the article Exrex - Irregular Methods On Regular Expressions this time, hopefully can benefit you all. okay, see you in another article posting.
You are now reading the article Exrex - Irregular Methods On Regular Expressions with the link address https://mederc.blogspot.com/2019/09/exrex-irregular-methods-on-regular.html