22
33#include < algorithm>
44#include < optional>
5- #include < regex>
65#include < string>
76
87namespace ada {
@@ -678,60 +677,45 @@ result<std::optional<url_pattern_result>> url_pattern<regex_provider>::match(
678677 }
679678 }
680679
681- auto regex_flags = std::regex_constants::match_any;
682-
683680 // Let protocolExecResult be RegExpBuiltinExec(urlPattern’s protocol
684681 // component's regular expression, protocol).
685- std::smatch protocol_exec_result_value;
686682 auto protocol_exec_result =
687- std::regex_search (protocol, protocol_exec_result_value,
688- protocol_component.regexp , regex_flags);
683+ regex_provider::regex_search (protocol, protocol_component.regexp );
689684
690685 // Let usernameExecResult be RegExpBuiltinExec(urlPattern’s username
691686 // component's regular expression, username).
692- std::smatch username_exec_result_value;
693687 auto username_exec_result =
694- std::regex_search (username, username_exec_result_value,
695- username_component.regexp , regex_flags);
688+ regex_provider::regex_search (username, username_component.regexp );
696689
697690 // Let passwordExecResult be RegExpBuiltinExec(urlPattern’s password
698691 // component's regular expression, password).
699- std::smatch password_exec_result_value;
700692 auto password_exec_result =
701- std::regex_search (password, password_exec_result_value,
702- password_component.regexp , regex_flags);
693+ regex_provider::regex_search (password, password_component.regexp );
703694
704695 // Let hostnameExecResult be RegExpBuiltinExec(urlPattern’s hostname
705696 // component's regular expression, hostname).
706- std::smatch hostname_exec_result_value;
707697 auto hostname_exec_result =
708- std::regex_search (hostname, hostname_exec_result_value,
709- hostname_component.regexp , regex_flags);
698+ regex_provider::regex_search (hostname, hostname_component.regexp );
710699
711700 // Let portExecResult be RegExpBuiltinExec(urlPattern’s port component's
712701 // regular expression, port).
713- std::smatch port_exec_result_value;
714- auto port_exec_result = std::regex_search (port, port_exec_result_value,
715- port_component.regexp , regex_flags);
702+ auto port_exec_result =
703+ regex_provider::regex_search (port, port_component.regexp );
716704
717705 // Let pathnameExecResult be RegExpBuiltinExec(urlPattern’s pathname
718706 // component's regular expression, pathname).
719- std::smatch pathname_exec_result_value;
720707 auto pathname_exec_result =
721- std::regex_search (pathname, pathname_exec_result_value,
722- pathname_component.regexp , regex_flags);
708+ regex_provider::regex_search (pathname, pathname_component.regexp );
723709
724710 // Let searchExecResult be RegExpBuiltinExec(urlPattern’s search component's
725711 // regular expression, search).
726- std::smatch search_exec_result_value;
727- auto search_exec_result = std::regex_search (
728- search, search_exec_result_value, search_component.regexp , regex_flags);
712+ auto search_exec_result =
713+ regex_provider::regex_search (search, search_component.regexp );
729714
730715 // Let hashExecResult be RegExpBuiltinExec(urlPattern’s hash component's
731716 // regular expression, hash).
732- std::smatch hash_exec_result_value;
733- auto hash_exec_result = std::regex_search (hash, hash_exec_result_value,
734- hash_component.regexp , regex_flags);
717+ auto hash_exec_result =
718+ regex_provider::regex_search (hash, hash_component.regexp );
735719
736720 // If protocolExecResult, usernameExecResult, passwordExecResult,
737721 // hostnameExecResult, portExecResult, pathnameExecResult, searchExecResult,
@@ -749,42 +733,42 @@ result<std::optional<url_pattern_result>> url_pattern<regex_provider>::match(
749733 // Set result["protocol"] to the result of creating a component match result
750734 // given urlPattern’s protocol component, protocol, and protocolExecResult.
751735 result.protocol = protocol_component.create_component_match_result (
752- protocol, protocol_exec_result_value );
736+ protocol, *protocol_exec_result );
753737
754738 // Set result["username"] to the result of creating a component match result
755739 // given urlPattern’s username component, username, and usernameExecResult.
756740 result.username = username_component.create_component_match_result (
757- username, username_exec_result_value );
741+ username, *username_exec_result );
758742
759743 // Set result["password"] to the result of creating a component match result
760744 // given urlPattern’s password component, password, and passwordExecResult.
761745 result.password = password_component.create_component_match_result (
762- password, password_exec_result_value );
746+ password, *password_exec_result );
763747
764748 // Set result["hostname"] to the result of creating a component match result
765749 // given urlPattern’s hostname component, hostname, and hostnameExecResult.
766750 result.hostname = hostname_component.create_component_match_result (
767- hostname, hostname_exec_result_value );
751+ hostname, *hostname_exec_result );
768752
769753 // Set result["port"] to the result of creating a component match result given
770754 // urlPattern’s port component, port, and portExecResult.
771- result.port = port_component. create_component_match_result (
772- port, port_exec_result_value );
755+ result.port =
756+ port_component. create_component_match_result ( port, *port_exec_result );
773757
774758 // Set result["pathname"] to the result of creating a component match result
775759 // given urlPattern’s pathname component, pathname, and pathnameExecResult.
776760 result.pathname = pathname_component.create_component_match_result (
777- pathname, pathname_exec_result_value );
761+ pathname, *pathname_exec_result );
778762
779763 // Set result["search"] to the result of creating a component match result
780764 // given urlPattern’s search component, search, and searchExecResult.
781765 result.search = search_component.create_component_match_result (
782- search, search_exec_result_value );
766+ search, *search_exec_result );
783767
784768 // Set result["hash"] to the result of creating a component match result given
785769 // urlPattern’s hash component, hash, and hashExecResult.
786- result.hash = hash_component. create_component_match_result (
787- hash, hash_exec_result_value );
770+ result.hash =
771+ hash_component. create_component_match_result ( hash, *hash_exec_result );
788772
789773 return result;
790774}
0 commit comments