Skip to content

geomagilles/Range-To-Regex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Create a regex that matches an Integer range

This is a PHP implementation of https://github.com/dimka665/range-regex.

It's not yet optimized (regex could be shorter) but it works.

Usage

regex_for_range(12, 34)

generates "1[2-9]|2\d|3[0-4]"

regex_for_range_complete(1368022487, 1368540887)

generates "136802248[7-9]|136802249\d|1368022[5-9]\d{2}|136802[3-9]\d{3}|13680[3-9]\d{4}|1368[1-4]\d{5}|13685[0-3]\d{4}|1368540[0-7]\d{2}|13685408[0-7]\d|136854088[0-7]"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published