conf: use [0-9] instead of [[:digit:]] for shorter re strings

This commit is contained in:
rofl0r 2020-09-30 05:28:00 +01:00
parent 960972865c
commit a8944b93e7

View File

@ -49,21 +49,22 @@
* can (and likely should) be used when building the regex for the * can (and likely should) be used when building the regex for the
* given directive. * given directive.
*/ */
#define DIGIT "[0-9]"
#define WS "[[:space:]]+" #define WS "[[:space:]]+"
#define STR "\"([^\"]+)\"" #define STR "\"([^\"]+)\""
#define BOOL "(yes|on|no|off)" #define BOOL "(yes|on|no|off)"
#define INT "(()[[:digit:]]+)" #define INT "(()" DIGIT "+)"
#define ALNUM "([-a-z0-9._]+)" #define ALNUM "([-a-z0-9._]+)"
#define USERNAME "([^:]*)" #define USERNAME "([^:]*)"
#define PASSWORD "([^@]*)" #define PASSWORD "([^@]*)"
#define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})" #define IP "((([0-9]{1,3})\\.){3}[0-9]{1,3})"
#define IPMASK "(" IP "(/[[:digit:]]+)?)" #define IPMASK "(" IP "(/" DIGIT "+)?)"
#define IPV6 "(" \ #define IPV6 "(" \
"(([0-9a-f:]{2,39}))|" \ "(([0-9a-f:]{2,39}))|" \
"(([0-9a-f:]{0,29}:" IP "))" \ "(([0-9a-f:]{0,29}:" IP "))" \
")" ")"
#define IPV6MASK "(" IPV6 "(/[[:digit:]]+)?)" #define IPV6MASK "(" IPV6 "(/" DIGIT "+)?)"
#define BEGIN "^[[:space:]]*" #define BEGIN "^[[:space:]]*"
#define END "[[:space:]]*$" #define END "[[:space:]]*$"