Update unit_test.c

This commit is contained in:
Sergey Lyubka 2016-03-10 09:46:23 +00:00
parent dd88b7d51d
commit fcc501baed

View File

@ -255,12 +255,12 @@ int main(void) {
"<img src=\"HTTPS://FOO.COM/x?b#c=tab1\"/> " "<img src=\"HTTPS://FOO.COM/x?b#c=tab1\"/> "
" <a href=\"http://cesanta.com\">some link</a>"; " <a href=\"http://cesanta.com\">some link</a>";
static const char *regex = "(?i)((https?://)[^\\s/'\"<>]+/?[^\\s'\"<>]*)"; static const char *regex = "((https?://)[^\\s/'\"<>]+/?[^\\s'\"<>]*)";
struct slre_cap caps[2]; struct slre_cap caps[2];
int i, j = 0, str_len = (int) strlen(str); int i, j = 0, str_len = (int) strlen(str);
while (j < str_len && while (j < str_len &&
(i = slre_match(regex, str + j, str_len - j, caps, 2, 0)) > 0) { (i = slre_match(regex, str + j, str_len - j, caps, 2, SLRE_IGNORE_CASE)) > 0) {
printf("Found URL: [%.*s]\n", caps[0].len, caps[0].ptr); printf("Found URL: [%.*s]\n", caps[0].len, caps[0].ptr);
j += i; j += i;
} }