Skip to content

Commit 2a2d2d2

Browse files
sebasfalconepboettch
authored andcommitted
CL: Splited regex string to improve readability
1 parent f24f8f4 commit 2a2d2d2

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/string-format-check.cpp

+31-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,37 @@ const std::string email{"(?:" + dotAtom + "|" + quotedString + ")@(?:" + stackov
358358
void rfc3986_uri_check(const std::string &value)
359359
{
360360
const static std::string scheme{R"(([A-Za-z][A-Za-z0-9+\-.]*):)"};
361-
const static std::string hierPart{R"((?:(\/\/)(?:((?:[A-Za-z0-9\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?((?:\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\.[A-Za-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[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:25[0-5]|)"
372+
R"(2[0-4][0-9]|)"
373+
R"([01]?[0-9][0-9]?))|)"
374+
R"((?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|)"
375+
R"((?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|)"
376+
R"([Vv][0-9A-Fa-f]+\.[A-Za-z0-9\-._~!$&'()*+,;=:]+)\]|)"
377+
R"((?:(?:25[0-5]|)"
378+
R"(2[0-4][0-9]|)"
379+
R"([01]?[0-9][0-9]?)\.){3}(?:25[0-5]|)"
380+
R"(2[0-4][0-9]|)"
381+
R"([01]?[0-9][0-9]?)|)"
382+
R"((?:[A-Za-z0-9\-._~!$&'()*+,;=]|)"
383+
R"(%[0-9A-Fa-f]{2})*))(?::([0-9]*))?((?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|)"
384+
R"(%[0-9A-Fa-f]{2})*)*)|)"
385+
R"(\/((?:(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|)"
386+
R"(%[0-9A-Fa-f]{2})+(?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|)"
387+
R"(%[0-9A-Fa-f]{2})*)*)?)|)"
388+
R"(((?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|)"
389+
R"(%[0-9A-Fa-f]{2})+(?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|)"
390+
R"(%[0-9A-Fa-f]{2})*)*)|))"};
391+
362392
const static std::string query{R"((?:\?((?:[A-Za-z0-9\-._~!$&'()*+,;=:@\/?]|%[0-9A-Fa-f]{2})*))?)"};
363393
const static std::string fragment{
364394
R"((?:\#((?:[A-Za-z0-9\-._~!$&'()*+,;=:@\/?]|%[0-9A-Fa-f]{2})*))?)"};

0 commit comments

Comments
 (0)