exrex icon indicating copy to clipboard operation
exrex copied to clipboard

expanding class digit range

Open zdilto opened this issue 3 years ago • 2 comments

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

zdilto avatar Sep 17 '21 11:09 zdilto

Yep, that's the RegEx standard, I know from having tried this with other RegEx Engines. Couldn't possibly had been so hard to make the ranges arbitrary instead of single integers.

rautamiekka avatar Sep 18 '21 00:09 rautamiekka

Why do you want to deviate from the regex standard, breaking compatibility, leading to unexpected behaviour?

sebix avatar Sep 18 '21 16:09 sebix