Skip to content

ericdorsey/testregexalternations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

What

For testing behavior of a range of values against a Regex that is made up of a variable number of capturing alternations.

ie, is this Regex (2[0-4]\d)|(25[0-5]) matching all values between 220-255?

Which parts of the alternations is each value matching?

Let's check:

user@box:~$ ./testregexalternations.py
220 matches 2[0-4]\d
221 matches 2[0-4]\d
222 matches 2[0-4]\d
223 matches 2[0-4]\d
224 matches 2[0-4]\d
225 matches 2[0-4]\d
226 matches 2[0-4]\d
227 matches 2[0-4]\d
228 matches 2[0-4]\d
229 matches 2[0-4]\d
230 matches 2[0-4]\d
231 matches 2[0-4]\d
232 matches 2[0-4]\d
233 matches 2[0-4]\d
234 matches 2[0-4]\d
235 matches 2[0-4]\d
236 matches 2[0-4]\d
237 matches 2[0-4]\d
238 matches 2[0-4]\d
239 matches 2[0-4]\d
240 matches 2[0-4]\d
241 matches 2[0-4]\d
242 matches 2[0-4]\d
243 matches 2[0-4]\d
244 matches 2[0-4]\d
245 matches 2[0-4]\d
246 matches 2[0-4]\d
247 matches 2[0-4]\d
248 matches 2[0-4]\d
249 matches 2[0-4]\d
250 matches 25[0-5]
251 matches 25[0-5]
252 matches 25[0-5]
253 matches 25[0-5]
254 matches 25[0-5]
255 matches 25[0-5]

Regex tested against:
non-named captures: (2[0-4]\d)|(25[0-5])
named captures: (?P<label0>2[0-4]\d)|(?P<label1>25[0-5])

Releases

No releases published

Packages

No packages published

Languages