add is link checker
This commit is contained in:
14
src/security/is_link.hpp
Normal file
14
src/security/is_link.hpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <uuid/uuid.h>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
|
||||
namespace hack::security
|
||||
{
|
||||
inline bool is_link(const std::string& s)
|
||||
{
|
||||
static const std::regex e("^(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?$", std::regex_constants::icase);
|
||||
return std::regex_match (s, e);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user