Add is_regex_special()
Add is_regex_special(), a character class macro for chars that have a special meaning in regular expressions. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
8cc3299262
commit
f9b7cce61c
@ -26,6 +26,11 @@ static int test_is_glob_special(int c)
|
||||
return is_glob_special(c);
|
||||
}
|
||||
|
||||
static int test_is_regex_special(int c)
|
||||
{
|
||||
return is_regex_special(c);
|
||||
}
|
||||
|
||||
#define DIGIT "0123456789"
|
||||
#define LOWER "abcdefghijklmnopqrstuvwxyz"
|
||||
#define UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
@ -40,6 +45,7 @@ static const struct ctype_class {
|
||||
{ "isalpha", test_isalpha, LOWER UPPER },
|
||||
{ "isalnum", test_isalnum, LOWER UPPER DIGIT },
|
||||
{ "is_glob_special", test_is_glob_special, "*?[\\" },
|
||||
{ "is_regex_special", test_is_regex_special, "$()*+.?[\\^{|" },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user