diff --git a/starlette/middleware/cors.py b/starlette/middleware/cors.py
index ad2eeff..90ba180 100644
--- a/starlette/middleware/cors.py
+++ b/starlette/middleware/cors.py
@@ -87,7 +87,7 @@ class CORSMiddleware:
         if self.allow_all_origins:
             return True
 
-        if self.allow_origin_regex is not None and self.allow_origin_regex.match(
+        if self.allow_origin_regex is not None and self.allow_origin_regex.fullmatch(
             origin
         ):
             return True

diff --git a/tests/middleware/test_cors.py b/tests/middleware/test_cors.py
index bcba704..e8bf72f 100644
--- a/tests/middleware/test_cors.py
+++ b/tests/middleware/test_cors.py
@@ -122,7 +122,7 @@ def test_cors_allow_origin_regex():
     app.add_middleware(
         CORSMiddleware,
         allow_headers=["X-Example", "Content-Type"],
-        allow_origin_regex="https://*",
+        allow_origin_regex="https://.*",
     )
 
     @app.route("/")
@@ -171,6 +171,39 @@ def test_cors_allow_origin_regex():
     assert "access-control-allow-origin" not in response.headers
 
 
+def test_cors_allow_origin_regex_fullmatch():
+    app = Starlette()
+
+    app.add_middleware(
+        CORSMiddleware,
+        allow_headers=["X-Example", "Content-Type"],
+        allow_origin_regex="https://.*\.example.org",
+    )
+
+    @app.route("/")
+    def homepage(request):
+        return PlainTextResponse("Homepage", status_code=200)
+
+    client = TestClient(app)
+
+    # Test standard response
+    headers = {"Origin": "https://subdomain.example.org"}
+    response = client.get("/", headers=headers)
+    assert response.status_code == 200
+    assert response.text == "Homepage"
+    assert (
+        response.headers["access-control-allow-origin"]
+        == "https://subdomain.example.org"
+    )
+
+    # Test diallowed standard response
+    headers = {"Origin": "https://subdomain.example.org.hacker.com"}
+    response = client.get("/", headers=headers)
+    assert response.status_code == 200
+    assert response.text == "Homepage"
+    assert "access-control-allow-origin" not in response.headers
+
+
 def test_cors_credentialed_requests_return_specific_origin():
     app = Starlette()
 

Dangerous example regex for CORS Middleware?
Looking at the docs for CORS Middlware here: https://www.starlette.io/middleware/#corsmiddleware , under the `allow_origin_regex` attribute, the example value is `https://.*\.example\.org`.

However, based on the handler code for this at https://github.com/encode/starlette/blob/ab86530eddfcf56e0f7e5ca56f6ab69c15594a7d/starlette/middleware/cors.py#L90 , it appears `https://www.example.org.hacker.com` would pass as a valid origin, right?

It seems like the example should be `https://.*\.example\.org$`, yes?
tests/middleware/test_cors.py::test_cors_allow_origin_regex_fullmatch
tests/middleware/test_cors.py::test_cors_allow_all tests/middleware/test_cors.py::test_cors_allow_specific_origin tests/middleware/test_cors.py::test_cors_disallowed_preflight tests/middleware/test_cors.py::test_cors_allow_origin_regex tests/middleware/test_cors.py::test_cors_credentialed_requests_return_specific_origin tests/middleware/test_cors.py::test_cors_vary_header_defaults_to_origin tests/middleware/test_cors.py::test_cors_vary_header_is_properly_set tests/middleware/test_cors.py::test_cors_allowed_origin_does_not_leak_between_credentialed_requests