I intially just ran perl -MRegexp::List -le 'print Regexp::List->new->list2re( 4333 .. 9999 )' but that made a larger regex than I liked. Here's what I did by hand. It should be easy to follow how it's constructed.
$rx_4333 = qr/ (?: 4 3 3 [3-9] | 4 3 [4-9] \d | 4 [4-9] \d \d | [5-9] \d \d \d ) $/x
This next regex does the same thing but has less work to do. In the previous example, the different paths would have to retry matching stuff that was already known to be true (the first 4??? vs the second 4???). This does the minimum amount of work.
$rx_4333 = / (?: 4 (?: 3 (?: 3 [3-9] | [4-9] \d ) | [4-9] \d \d ) | [5-9] \d \d \d ) $/x
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re: Regular expression patter matching question
by diotalevi
in thread Regular expression pattern matching question
by ramya2005
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |