2012-09-21 22:47:52 +02:00
|
|
|
#ifndef URL_REGEX_HH
|
|
|
|
#define URL_REGEX_HH
|
|
|
|
|
|
|
|
#define USERCHARS "-[:alnum:]"
|
|
|
|
#define USERCHARS_CLASS "[" USERCHARS "]"
|
|
|
|
#define PASSCHARS_CLASS "[-[:alnum:]\\Q,?;.:/!%$^*&~\"#'\\E]"
|
|
|
|
#define HOSTCHARS_CLASS "[-[:alnum:]]"
|
2012-09-21 23:10:06 +02:00
|
|
|
#define HOST "(?:" HOSTCHARS_CLASS "+(\\." HOSTCHARS_CLASS "+)*)?"
|
2012-09-21 22:47:52 +02:00
|
|
|
#define PORT "(?:\\:[[:digit:]]{1,5})?"
|
2012-09-21 23:05:11 +02:00
|
|
|
#define SCHEME "(?:[[:alpha:]][+-.[:alnum:]]*:)"
|
2012-09-21 22:47:52 +02:00
|
|
|
#define USERPASS USERCHARS_CLASS "+(?:" PASSCHARS_CLASS "+)?"
|
2012-09-22 02:45:30 +02:00
|
|
|
#define URLPATH "(?:/[[:alnum:]\\Q$-_.+!*'(),;/?:@&=\\E]*)"
|
2012-09-21 22:47:52 +02:00
|
|
|
|
|
|
|
const char * const url_regex = SCHEME "//(?:" USERPASS "\\@)?" HOST PORT URLPATH;
|
|
|
|
|
2012-07-20 17:32:15 +02:00
|
|
|
#endif
|