mirror of
https://github.com/tristanpenman/valijson.git
synced 2025-03-03 04:38:40 +01:00
Update urn regex expression to be std::regex safe
This commit is contained in:
parent
f787a8a7a7
commit
3442709aa7
@ -22,11 +22,11 @@ inline bool isUriAbsolute(const std::string &documentUri)
|
||||
/**
|
||||
* @brief Placeholder function to check whether a URI is a URN
|
||||
*
|
||||
* This function validates that the URI matches the RFC 8141
|
||||
* This function validates that the URI matches the RFC 8141 spec
|
||||
*/
|
||||
inline bool isUrn(const std::string &documentUri) {
|
||||
static const std::regex pattern(
|
||||
"^(?i:urn:(?!urn:)([a-z0-9][a-z0-9-]{1,31}):((?:[-a-z0-9()+,.:=@;$_!*'&~\\/]|%[0-9a-f]{2})+)(?:\\?\\+(.*?))?(?:\\?=(.*?))?(?:#(.*?))?)$");
|
||||
"^((urn)|(URN)):(?!urn:)([a-zA-Z0-9][a-zA-Z0-9-]{1,31})(:[-a-zA-Z0-9\\\\._~%!$&'()\\/*+,;=]+)+(\\?[-a-zA-Z0-9\\\\._~%!$&'()\\/*+,;:=]+){0,1}(#[-a-zA-Z0-9\\\\._~%!$&'()\\/*+,;:=]+){0,1}$");
|
||||
|
||||
return std::regex_match(documentUri, pattern);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user