rgxg_number_range() generates the (extended) regular expression that matches integers in the range
between first and last.
rgxg_number_greaterequal() generates the (extended) regular expression that matches integers greater than
or equal to number.
The base of the matched integers is specified by base, which must be between 2 and 32 inclusive. Note
that for bases greater than 16 the "extended hex" alphabet is used (referenced as 'base32hex' in RFC4648).
If RGXG_LEADINGZERO or RGXG_VARLEADINGZERO is set, then min_length specifies the minimum length of the
matched integers (otherwise the argument is ignored). For instance the number 5 with min_length set to 3
and options set to RGXG_LEADINGZERO is matched as '005'. By default the number of leading zeros depends
on the length of the last number. If min_length is lesser than or equal to the number of digits of last,
the value has no effect.
The generated regular expression is written to the character string regex, including the terminating null
byte ('\0'), unless RGXG_NONULLBYTE is set. If regex is NULL the return value is the number of characters
(excluding the terminating null byte) that would have been written in case regex has been initialized.
Note that the functions assume an arbitrarily long regex string, callers must ensure that the given
string is large enough to not overflow the actual space.
options is either zero, or the bitwise-or of one or more of the following macros:
RGXG_NOUPPERCASE
The generated regular expression only matches lower case letters for base values greater than 10.
The default is to match both lower and upper case letters.
RGXG_NOLOWERCASE
The generated regular expression only matches upper case letters for base values greater than 10.
The default is to match both lower and upper case letters.
RGXG_NOOUTERPARENS
Omit the outer parenthesis, if any, of the regular expression.
RGXG_LEADINGZERO
The generated regular expression only matches integers with leading zeros (e.g. the integer 5 is
only matched as '005'). The number of leading zeros is influenced by the min_length argument (see
above). By default no leading zeros are matched.
RGXG_VARLEADINGZERO
The generated regular expression matches integers with a variable number of leading zeros (e.g.
the number 5 is matched as '5', '05' and '005'). The maximum number of leading zeros is influenced
by the min_length argument (see above). By default no leading zeros are matched.
RGXG_NONULLBYTE
Do not add the terminating null byte ('\0') to the regex string.
Note that RGXG_NOUPPERCASE and RGXG_NOLOWERCASE as well as RGXG_LEADINGZERO and RGXG_VARLEADINGZERO are
mutual exclusive options.