17 lines
871 B
Plaintext
17 lines
871 B
Plaintext
$OpenBSD: patch-menu_c,v 1.1.1.1 2016/05/03 18:42:51 jca Exp $
|
|
Refactor to exclude GNU extensions in regex
|
|
--- menu.c.orig Tue Jul 29 22:49:11 2014
|
|
+++ menu.c Sat Apr 30 23:27:00 2016
|
|
@@ -27,10 +27,7 @@ char *extract_urls(const char *to_match)
|
|
static regex_t cregex;
|
|
|
|
if (!is_initialized) {
|
|
- char *regex =
|
|
- "\\b(https?://|ftps?://|news://|mailto:|file://|www\\.)"
|
|
- "[[:alnum:]\\-\\@;/?:&=%$.+!*\x27,~#]*"
|
|
- "(\\([[:alnum:]\\-\\@;/?:&=%$.+!*\x27,~#]*\\)|[[:alnum:]\\-\\@;/?:&=%$+*~])+";
|
|
+ char *regex = "[[:<:]](https?://|ftps?://|news://|mailto:|file://|www\\.)[0-9a-zA-Z_/.@]+[a-zA-Z/]";
|
|
int ret = regcomp(&cregex, regex, REG_EXTENDED | REG_ICASE);
|
|
if (ret != 0) {
|
|
printf("failed to compile regex\n");
|