2012-09-21 22:47:52 +02:00
|
|
|
#ifndef URL_REGEX_HH
|
|
|
|
#define URL_REGEX_HH
|
|
|
|
|
|
|
|
#define USERCHARS "-[:alnum:]"
|
|
|
|
#define USERCHARS_CLASS "[" USERCHARS "]"
|
2017-04-30 23:53:56 +02:00
|
|
|
#define PASSCHARS_CLASS "[-[:alnum:]\\Q,?;.!%$^*&~\"#'\\E]"
|
2012-09-21 22:47:52 +02:00
|
|
|
#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:]]*:)"
|
2017-04-30 23:53:25 +02:00
|
|
|
#define USERPASS USERCHARS_CLASS "+(?:\\:" PASSCHARS_CLASS "+)?"
|
2012-10-07 17:45:37 +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
|