Giter Site home page Giter Site logo

exrex's People

Contributors

adisakshya avatar asciimoo avatar dalai4git avatar deronnax avatar dnet avatar evasdk avatar fgsch avatar graingert avatar kokke avatar movermeyer avatar sebix avatar sumslogs avatar vwyu avatar waldyrious avatar zekfad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exrex's Issues

Quantifiers generate TypeError

Hi!

I tried to generate passwords using patterns, like 2 upper case letters and 2 lower case letters need to be in the generated string, but I ran into the following problem. For example this regex:

^(?=(.*[A-Z])){2}(?=(.*[a-z])){2}(?=.*\d)(?=.*[\!\_\"])[A-Za-z\d\!\_\"]{9,9}$

As you can see I have two {2} selectors in the regex, and this throws the following error:

  File "regexpassgen.py", line 17, in <module>
    for p in passwords:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 134, in prods
    for i in ret:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 143, in ggen
    for a in g1:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 143, in ggen
    for a in g1:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 143, in ggen
    for a in g1:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 143, in ggen
    for a in g1:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 143, in ggen
    for a in g1:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 143, in ggen
    for a in g1:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 143, in ggen
    for a in g1:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 143, in ggen
    for a in g1:
  File "/usr/local/lib/python2.7/dist-packages/exrex.py", line 148, in ggen
    yield a + b
TypeError: can only concatenate list (not "unicode") to list

I think the curly brackets need to be escaped or something? I'm not quite sure, but without them the command parameter runs just fine. Can you think of a hint how to fix it?

Option to generate strings for case insensitive matches

Maybe you will find it a nice and simple to implement feature: to be able to iterate over all strings that matches regular expression ignoring letters case.
E.g. "a{1,2}" will generate "aa", "aA", "Aa", "AA".

P.S. Thanks for this library, it helped me a lot!

Randomize All

can exrex randomize all the output in addition of the -r option like -rall that will generate all possible output without using an external script like randomizeLines.py as an example:

``

exrex [a-z]{3}
cfg
hyv
dtr
und
ilk
etc...
``

add is_infinite property/method

count() inaccurately returns finite integer when regex has infinite matches.
Solution would be to provide is_infinite() property/method.

is_infinite('[ab]+') => True
is_infinite('[ab]') => False

Thanks.

[solved] incorrect behavior in {n,m} Quantifier

exrex will correctly Output quantifier result if following conditions are met:
"[9]{0,20}" ---> {0-20,1-20}
"[9]{11,20}" ---> {11-???,20-???}

exrex will incorrectly Output quantifier result if following conditions are met:
"[9]{1,21}" -----> m stops at 20
"[9]{9,30}" ---> m stops at 28
"[9]{10,30}" ----> m stops at 29
"[9]{100,300}" ---> m stops at 119

UPDATE:
exrex will only iterate 20 times no matter the "m" quantifier is.

exrex "[9]{10,40}"

9999999999
99999999999
999999999999
9999999999999
99999999999999
999999999999999
9999999999999999
99999999999999999
999999999999999999
9999999999999999999
99999999999999999999
999999999999999999999
9999999999999999999999
99999999999999999999999
999999999999999999999999
9999999999999999999999999
99999999999999999999999999
999999999999999999999999999
9999999999999999999999999999
99999999999999999999999999999 ---> stopped only when "m" is 29 iterating 20 times

Import error using Python 3.11.0

I try using this library in Python 3.11.0 and I get an import error:

    import exrex
../../../env/lib/python3.11/site-packages/exrex.py:25: in <module>
    from re import sre_parse, U
E   ImportError: cannot import name 'sre_parse' from 're'

Missing some possible strings

Hi there!

Thanks for making this, I've been looking for one and was surprised at how hard they are to find.

I think I found an issue with generating all the strings for a regex, however. This is my regex:

22(2(((1{1,2}(4|3)(1|0))|0)2){3}){2}22

Exrex outputs these strings:

222141214121412214121412141222
222140214021402214021402140222
222131213121312213121312131222
222130213021302213021302130222
222114121141211412211412114121141222
222114021140211402211402114021140222
222113121131211312211312113121131222
222113021130211302211302113021130222
222020202202020222

To help parse these visually, I usually break lines before and after segments of 2s. So, for the first string returned by exrex (222141214121412214121412141222), it would look like this:

222
141
2
141
2
141
22
141
2
141
2
141
222

This is a correct string, as are the rest. However, many strings are not included with the output which should be. One example where I just change the 4 on the second line to a 3: (222131214121412214121412141222)

222
131
2
141
2
141
22
141
2
141
2
141
222

This string is accepted by regex checkers like Rubular.com, so it should be produced in the output of exrex.

It looks like what is happening is, when forced to choose with the "|", exrex picks one and then sticks with it for the rest of the string, even if the same | is visited again.

I haven't looked through your code yet because I wanted to go ahead and report what I found while I have time. Thanks for writing this code, I haven't seen this elsewhere! If I find something, I'll let you know.

backreference issue

first backreference \1 will not be matched if there is more than one ( ) and followed by ? or {0,1} like in below example:

exrex.py "(19[0-9][0-9]|20[0-9][0-9]|[0-9][0-9]){0,1}@?(alae|yassine?)@?\1@?"

output:

Traceback (most recent call last): File "C:\Users\Youness\Desktop\exrex-master\exrex.py", line 542, in <module> __main__() File "C:\Users\Youness\Desktop\exrex-master\exrex.py", line 529, in __main__ args['output'].write(next(g)) File "C:\Users\Youness\Desktop\exrex-master\exrex.py", line 126, in prods for o in orig: File "C:\Users\Youness\Desktop\exrex-master\exrex.py", line 84, in dappend yield cc + d[k] KeyError: 1

i think in case when no output will be generated due to all pattern are followed by ? then need to escape the null,empty error and not to raise it and continue till the end

Syntax error on import after initial install

git clone https://github.com/asciimoo/exrex.git

Initialized empty Git repository in /tmp/exrex/.git/
remote: Counting objects: 353, done.
remote: Total 353 (delta 0), reused 0 (delta 0), pack-reused 353
Receiving objects: 100% (353/353), 391.81 KiB | 292 KiB/s, done.
Resolving deltas: 100% (165/165), done.

cd exrex/

python ./setup.py install

running install
running bdist_egg
running egg_info
creating exrex.egg-info
writing exrex.egg-info/PKG-INFO
writing top-level names to exrex.egg-info/top_level.txt
writing dependency_links to exrex.egg-info/dependency_links.txt
writing entry points to exrex.egg-info/entry_points.txt
writing manifest file 'exrex.egg-info/SOURCES.txt'
reading manifest file 'exrex.egg-info/SOURCES.txt'
writing manifest file 'exrex.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
copying exrex.py -> build/lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib/exrex.py -> build/bdist.linux-x86_64/egg
byte-compiling build/bdist.linux-x86_64/egg/exrex.py to exrex.pyc
SyntaxError: ('invalid syntax', ('build/bdist.linux-x86_64/egg/exrex.py', 49, 33, 'REVERSE_CATEGORIES = {vv[1]:k for k,v\n'))

creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/scripts-2.6
copying and adjusting exrex.py -> build/scripts-2.6
changing mode of build/scripts-2.6/exrex.py from 644 to 755
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-2.6/exrex.py -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/exrex.py to 755
copying exrex.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying exrex.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying exrex.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying exrex.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying exrex.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/exrex-0.9.3-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing exrex-0.9.3-py2.6.egg
creating /usr/lib/python2.6/site-packages/exrex-0.9.3-py2.6.egg
Extracting exrex-0.9.3-py2.6.egg to /usr/lib/python2.6/site-packages
SyntaxError: ('invalid syntax', ('/usr/lib/python2.6/site-packages/exrex-0.9.3-py2.6.egg/exrex.py', 49, 33, 'REVERSE_CATEGORIES = {vv[1]:k for k,v\n'))

Adding exrex 0.9.3 to easy-install.pth file
Installing exrex.py script to /usr/bin
Installing exrex script to /usr/bin

Installed /usr/lib/python2.6/site-packages/exrex-0.9.3-py2.6.egg
Processing dependencies for exrex==0.9.3
Finished processing dependencies for exrex==0.9.3

python

Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import exrex
Traceback (most recent call last):
File "", line 1, in
File "exrex.py", line 49
REVERSE_CATEGORIES = {vv[1]:k for k,v
^
SyntaxError: invalid syntax

Python 3.6 issue with groups

With Python 3.6, the command exrex "(a|b)" results in error:

Traceback (most recent call last):
  File "~/.local/bin/exrex", line 11, in <module>
    load_entry_point('exrex==0.10.4', 'console_scripts', 'exrex')()
  File "~/.local/bin/exrex.py", line 512, in __main__
    args['output'].write(next(g))
  File "~/.local/bin/exrex.py", line 144, in ggen
    g2 = f(*args, **kwargs)
  File "~/.local/bin/exrex.py", line 167, in _gen
    for i in d:
TypeError: 'int' object is not iterable

I expect to see:

a
b

It seems that the problem is due to a change in what is returned from the parse function in Python 3.6.

I tried the following in both Python 3.5.2 and Python 3.6:

from re import sre_parse
print(sre_parse.parse("(a|b)"))

The result for Python 3.5.2:

[(SUBPATTERN, (1, [(IN, [(LITERAL, 97), (LITERAL, 98)])]))]

The result for Python 3.6:

[(SUBPATTERN, (1, 0, 0, [(IN, [(LITERAL, 97), (LITERAL, 98)])]))]

[solved] getting REGEX pattern from text file content

after using exrex for months now, i finally stuck in a problem where i really need to get REGEX pattern from a file instead of the normal method: exrex.py "[a-z][0-9]{0,2}"

getting REGEX patterns from a text file line by line without the need to start new instance of exrex .

example:

patternfile.txt contents:
[a-z][0-9]{0,2}
[a-z][A-Z][a-z]{7}
myName[0-9]{4}

one run code:
exrex.py patternfile.txt

output:
a
a0
a00
......
s59
b7
......
aAv4621397
......
myName1980
.......

hope exrex will be updated very soon with this feature and other user suggested ones

we really rely and this software and this method to complete our work

Feature: Multiple patters (AND condition)

Add option -e REGEX with support to be added multiple times and generate an example that matches all of the given REGEXes (AND condition).
Example: exrex -e 'a.' -e '.b' would give 'ab'

Error in exrex.count

I observe the following behavior, and it is obviously incorrect:

>>> list(exrex.generate("a|ab"))
[u'a', u'ab']
>>> exrex.count("a|ab")
1

Allow input of capture groups

I'm interested in being able to generate strings from a regular expression, but also with known values of the capture groups. For example, if we had the regex First Name: (\w+), Last Name: (\w+), and known values of John, and Smith, I'd want it to use these values instead of generating them, resulting in a string like First Name: John, Last Name: Smith. The API would be something like getone(some_regex: str, known_values: list)

Is this within the scope of this project?

Handling greedy patterns

Hi there. I'm hitting this error

$ pip show exrex
Name: exrex
Version: 0.10.5
...
$ exrex "The path file (.*?) is not configured" -c
[!] cannot handle expression ('min_repeat', (0, 4294967295L, [('any', None)]))
1

and trying to think ways to handle it, so far to no avail. Should be an option that makes sense for this scenario?

error with range [^\n]

I have a problem with your module when I trying to generate strings for the regex CEL(?!\n)\s[^\n]{100}
the output error is :
File "/home/thomas/workspace/regexCompiler/trunk/regexToVHDL/v2/regexparser.py", line 407, in listOfPossibleString
tmpStr=exrex.getone(self.regex)
File "/usr/lib/python3.5/site-packages/exrex.py", line 412, in getone
return _randone(parse(regex_string), limit)
File "/usr/lib/python3.5/site-packages/exrex.py", line 258, in _randone
ret += _randone(list(i[1][2]), limit, grouprefs)
File "/usr/lib/python3.5/site-packages/exrex.py", line 271, in _randone
c.remove(unichr(i[1]))
ValueError: list.remove(x): x not in list

It seems that the return table doen't containt the character '\n'

Count is very inaccurate

I've tried generate some dictionary and count shows me something like 150 items. Looks fine, but generated dictionary was 500 MB of size.

Then i found a problem. This result is correct:

$ exrex "[0-9]{4}" -c
10000

But this, which is basically the same is not:

$ exrex "[0-9]{2}[0-9]{2}" -c
200

Looks like there is sum instead of multiply between count([0-9]{2}).

My version of exrex is 0.10.5

Something wrong with [char-class]{quantity}

I am seeing different counts than expected when using braced fixed-quantities after character class expressions. There is a regex for the numeric range 0 to 65535, whose count should be 65536:

>>> exrex.count('^([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9]|65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5])$')                
65536

While count() works great in the above case, it does not when I condense the regex using braced fixed-quantities:

>>> exrex.count('^([0-9]|[1-9][0-9]|[1-9][0-9]{2}|[1-9][0-9]{3}]|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$')
12369

To make it more interesting, the braced fixed quantities work again it they are grouped using parentheses with the expression they are repeating:

>>> exrex.count('^([0-9]|[1-9][0-9]|[1-9]([0-9]{2})|[1-9]([0-9]{3})]|[1-5]([0-9]{4})|6[0-4]([0-9]{3})|65[0-4]([0-9]{2})|655[0-2][0-9]|6553[0-5])$')
65536

So, there appears to be a bug somewhere in what gets generated when the regex includes quantities for character classes and using grouping to ensure the quantity applies to just the preceding character class appears to address it. Thanks!

Seed Support

It would be great if exrex can support seeding when generating a random string from pattern; something like

pattern = r'(A|N)[0-5]{3}'
string1 = exrex.getone(pattern, seed=777)
string2 = exrex.getone(pattern, seed=777)

string1 == string2  # returns True

This should be possible if standard Python's random instance is used

High memory consumption when using atom groups

$ python exrex.py -r -l 5 '[^/]+.*'

This one works like charm.

$ python exrex.py -r -l 5 '([^/]+)(.*)'
$ python exrex.py -r -l 5 '[^/]+(.*)'
$ python exrex.py -r -l 5 '([^/]+).*'

These try to consume all my memory until the OS kills the process.

some wrong with using exrex

I can't use 'exrex' neither in windows nor in debian.

Traceback (most recent call last):
File "", line 1, in
File "exrex.py", line 2, in
from exrex import exrex
ImportError: cannot import name exrex

I have try all the ways to install exrex,but it not work.
easy_install / pip install /pip2/ or python setup.py install

help me.thanks.

Matching/generating incorrect strings

The regex ^(?=ca)([a-z]{4})$ should allow

cars
cast
cabs

..but not

car
cargo
castrate

...as they are not 4 letters long. exrex is generating strings starting with ca and followed by any 4 lowercase alphanumeric characters e.g. cabhzp. The example here shows how it should work.

(?=ca)(^[a-z]{4}$) is another example.

Multiple random results

This is similar to #44, but instead of randomizing the entire output, I'd suggest that the -r/--random option could be combined with -m/--max-number, to produce N random strings (with the default number being 1 if -m is not specified, which preserves the current behavior).

limit flag on generate() vs getone()

Maybe I don't quite understand the limit flag on the two methods, generate() and getone(). I would expect that the limit flag is used to cap any substitution performed.

# 41 is two characters long, I wanted a cap of 1
>>> exrex.getone(r'^(detail|test)/(?P<pk>\d+)/$', limit=1)
'test/41/'
# this seems to be okay using the generator
>>> g = exrex.generate(r'^(detail|test)/(?P<pk>\d+)/$', limit=1)
>>> while True:
...   next(g)
... 
'detail/0/'
'detail/1/'
'detail/2/'
'detail/3/'
'detail/4/'
'detail/5/'
'detail/6/'
'detail/7/'
'detail/8/'
'detail/9/'
'test/0/'
'test/1/'
'test/2/'
'test/3/'
'test/4/'
'test/5/'
'test/6/'
'test/7/'
'test/8/'
'test/9/'
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
StopIteration
>>> 

Is this a bug or am I misunderstanding the module usage?

simplify screws up literal special characters

simplify turns a literal period into an unescaped period.

>>> import exrex
>>> exrex.simplify(r'\.')
'.'
>>> exrex.simplify('[.]')
'.'

EDIT: This affects any single special character.

Counting problem with multiplication

For this regular expression exrex.count gives less than the real value:

In [33]: re = r'(1[0-2]|0[1-9])(:[0-5]\d){2} (A|P)M'

In [34]: exrex.count(re)
Out[34]: 7224

In [35]: 12*60*60*2  # This should be the value (as many seconds in a day)
Out[35]: 86400

However for the part, I thought to be critical, it works well:

In [36]: re = r'(:[0-5]\d){2}'

In [37]: exrex.count(re)
Out[37]: 3600

Version 0.10.5

test `limit=` in `count()`

At the moment the test does not check what happens if you try to count a large regex but give the qwarg limit=.

Question about some sequences

Hello @asciimoo

I'm having problem to generate two sequences, the first is something like this:

['ABCX9995', 'ABCX9996', 'ABCX9997', 'ABCX9998', 'ABCX9999', 'ABCY0001', 'ABCY0002']

The last part(number sequence) start at 0001 and go until 9999, when it reaches 9999 the letter changes and it should come back to 0001

I've already tried:
'ABC[XY][0-9]{4}'
'ABC[XY][0001-9999]{4}'

The other problem that I'm trying to solve is the start of the sequence, suppose that I have the same sequence above and I want to start it at ABCY1500, Is that possible?

Consider license change?

Hello!

I would very much like to use this package, but I am prevented by doing so due to it being licensed under AGPL. Would you consider switching to LGPL, BSD, or CC licensing?

simplification error with `|` and a prefix

$ exrex -sv '^(prefix/1|prefix/23)'
[(AT, AT_BEGINNING), (SUBPATTERN, (1, 0, 0, [(LITERAL, 112), (LITERAL, 114), (LITERAL, 101), (LITERAL, 102), (LITERAL, 105), (LITERAL, 120), (LITERAL, 47), (BRANCH, (None, [[(LITERAL, 49)], [(LITERAL, 50), (LITERAL, 51)]]))]))]
^(prefix/1|23)

$ exrex -sv '^(prefix/1|23)'
[(AT, AT_BEGINNING), (SUBPATTERN, (1, 0, 0, [(BRANCH, (None, [[(LITERAL, 112), (LITERAL, 114), (LITERAL, 101), (LITERAL, 102), (LITERAL, 105), (LITERAL, 120), (LITERAL, 47), (LITERAL, 49)], [(LITERAL, 50), (LITERAL, 51)]]))]))]
^(prefix/1|23)

Looks like it doesn't insert the () necessary to preserve the original logic (I'd probably expect something like ^(prefix/(1|23)) here). Interestingly, if I make the outer group non-capturing, it corrects the issue:

$ exrex -sv '^(?:prefix/1|prefix/23)'
[(AT, AT_BEGINNING), (LITERAL, 112), (LITERAL, 114), (LITERAL, 101), (LITERAL, 102), (LITERAL, 105), (LITERAL, 120), (LITERAL, 47), (BRANCH, (None, [[(LITERAL, 49)], [(LITERAL, 50), (LITERAL, 51)]]))]
^prefix/(?:1|23)

Otherwise, thanks for the great lib!

Minimum String Length

The limit argument allows me to set a maximum length for the returned string, but i have no way to set the minimum. I attempted to use a forward lookahead in the regex pattern, but it seems like it is ignored.

^(?=.{12,16}$)(9*)$

So that should give me strings with a minimum length of 12 and maximum length of 16 made up of 9s. When i run this it spits out a whole lot of random stuff. If i take away the lookahead, it correctly gives me the 9s

^(9*)$

If lookaheads or lookbehinds are not the right way to set string minimums, what is? If they are the correct way, what is going wrong with exrex?

EDIT: I should note that my desired regex pattern is quite a bit more involved than a bunch of 9s, I am just using it here as a simplified example for setting minimum lengths. My desired pattern for which i wish to set a minimum length is

^(2{0,1}3{0,1}4{0,1}6{0,1}7*8*9*|3{0,1}5{0,1}7*9*)$

Improve simplify

# exrex -s '(aa|ba|ca)'
(aa|ba|ca)

but actually it could be: (a|b|c)a

Errors on simplifying regex

I'm trying to simplify regex

(3(0[1-9]|[1-9][0-9])|[4-9][0-9]{2}|[1-9][0-9]{3,8}|[1-4][0-9]{9}|5([0-3][0-9]{8}|4([0-7][0-9]{7}|8([0-2][0-9]{6}|30(0[0-9]{4}|1([01][0-9]{3}|2([0-6][0-9]{2}|7([0-7][0-9]|8[0-2]))))))))

and getting such errors:

[!] cannot handle expression "('range', (49, 57))"
[!] cannot handle expression "('range', (49, 57))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (52, 57))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (49, 57))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (49, 52))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (48, 51))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (48, 55))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (48, 50))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (48, 54))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (48, 55))"
[!] cannot handle expression "('range', (48, 57))"
[!] cannot handle expression "('range', (48, 50))"

expanding class digit range

range like [0-80] will only match 1 digit at a time:

exrex "[0-80]"
0
1
2
3
4
5
6
7
8
0

i think is a good feature if exrex can count the whole range and from 0 to 80:
0
1
2
..
23
..
65
..
80

it will facilate regex pattern considerably like in generating the following local ip address range: 192.168.0.0-192.168.255.255
for generating this ips one need to write a complex regex:

"^192\.168\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))$"

but if supported we will only write:

"^192\.168\.[0-255]\.[0-255]$"

for making things easier we can write [n--m] or [n..m] [0--100] or [0..100] avoiding collision with regex class handling

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.