diff --git a/termite.cc b/termite.cc index 30f8288..f42ffe9 100644 --- a/termite.cc +++ b/termite.cc @@ -9,10 +9,9 @@ #include #include -#define CSI "\x1b[" +#include "url_regex.h" -// http://blog.dieweltistgarnichtso.net/constructing-a-regular-expression-that-matches-uris -static const char * const url_regex = R"XXX(((?<=\()[A-Za-z][A-Za-z0-9\+\.\-]*:([A-Za-z0-9\.\-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+(?=\)))|([A-Za-z][A-Za-z0-9\+\.\-]*:([A-Za-z0-9\.\-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+))XXX"; +#define CSI "\x1b[" enum class overlay_mode { hidden, diff --git a/url_regex.h b/url_regex.h new file mode 100644 index 0000000..4c33e39 --- /dev/null +++ b/url_regex.h @@ -0,0 +1,4 @@ +#ifndef URL_REGEX +#define URL_REGEX +const char * const url_regex = R"XXX(((?<=\()[A-Za-z][A-Za-z0-9\+\.\-]*:([A-Za-z0-9\.\-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+(?=\)))|([A-Za-z][A-Za-z0-9\+\.\-]*:([A-Za-z0-9\.\-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+))XXX"; +#endif