diff --git a/core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorFeedTest.php b/core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorFeedTest.php
index f3fa94478a14bc315b3235b638f6e8fe805c184d..94ebb19f372962b4ebbe0fb12665982886fa3bfa 100644
--- a/core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorFeedTest.php
+++ b/core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateAggregatorFeedTest.php
@@ -47,7 +47,7 @@ public function testAggregatorFeedImport() {
     $this->assertNull($feed->getImage());
     // As with getLastCheckedTime(), the etag can change as the fixture is
     // updated normally, so assert that its format is correct.
-    $this->assertRegExp('/^"[a-z0-9]{32}"$/', $feed->getEtag());
+    $this->assertMatchesRegularExpression('/^"[a-z0-9]{32}"$/', $feed->getEtag());
     $this->assertSame('0', $feed->getLastModified());
   }
 
diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php
index 1d2b30d074dd17efd0ae807e7f6688eb6930ad5e..33550b37f8d0829a20f6e792d845862add8f11c9 100644
--- a/core/modules/dblog/tests/src/Functional/DbLogTest.php
+++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php
@@ -180,7 +180,7 @@ public function test403LogEventPage() {
     $message = $table[0]->findAll('xpath', "//tr/th[contains(text(), 'Message')]/../td");
     $this->assertCount(1, $message);
     $regex = "@Path: .+admin/reports\. Drupal\\\\Core\\\\Http\\\\Exception\\\\CacheableAccessDeniedHttpException: The 'access site reports' permission is required\. in Drupal\\\\Core\\\\Routing\\\\AccessAwareRouter->checkAccess\(\) \(line \d+ of .+/core/lib/Drupal/Core/Routing/AccessAwareRouter\.php\)\.@";
-    $this->assertRegExp($regex, $message[0]->getText());
+    $this->assertMatchesRegularExpression($regex, $message[0]->getText());
   }
 
   /**
diff --git a/core/modules/jsonapi/tests/src/Functional/EntryPointTest.php b/core/modules/jsonapi/tests/src/Functional/EntryPointTest.php
index 88e65c2f91e0f2b212affc048ee771a68491549b..22f5da27cc5efe28ca04108347c4ed4583e88602 100644
--- a/core/modules/jsonapi/tests/src/Functional/EntryPointTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/EntryPointTest.php
@@ -50,9 +50,9 @@ public function testEntryPoint() {
     $optimized_expected_cache_contexts = \Drupal::service('cache_contexts_manager')->optimizeTokens($expected_cache_contexts);
     $this->assertSame($optimized_expected_cache_contexts, explode(' ', $response->getHeader('X-Drupal-Cache-Contexts')[0]));
     $links = $document['links'];
-    $this->assertRegExp('/.*\/jsonapi/', $links['self']['href']);
-    $this->assertRegExp('/.*\/jsonapi\/user\/user/', $links['user--user']['href']);
-    $this->assertRegExp('/.*\/jsonapi\/node_type\/node_type/', $links['node_type--node_type']['href']);
+    $this->assertMatchesRegularExpression('/.*\/jsonapi/', $links['self']['href']);
+    $this->assertMatchesRegularExpression('/.*\/jsonapi\/user\/user/', $links['user--user']['href']);
+    $this->assertMatchesRegularExpression('/.*\/jsonapi\/node_type\/node_type/', $links['node_type--node_type']['href']);
     $this->assertArrayNotHasKey('meta', $document);
 
     // A `me` link must be present for authenticated users.
diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
index 21355af2fc5f2019a21ca26afae8af77a18708d4..9f012309e5acbc1e0593f6ee62de6deea589ffb6 100644
--- a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
@@ -196,7 +196,7 @@ public function testRead() {
     $this->assertCount(1, $non_help_links);
     $link_keys = array_keys($single_output['meta']['omitted']['links']);
     $this->assertSame('help', reset($link_keys));
-    $this->assertRegExp('/^item--[a-zA-Z0-9]{7}$/', next($link_keys));
+    $this->assertMatchesRegularExpression('/^item--[a-zA-Z0-9]{7}$/', next($link_keys));
     $this->nodes[1]->set('status', TRUE);
     $this->nodes[1]->save();
     // 13. Test filtering when using short syntax.
diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php
index 41726449307182379571a0ce09841f66a3ed16e1..094687a3efa4681d56daa87b5fc0015aeabc9467 100644
--- a/core/modules/system/tests/src/Functional/Form/FormTest.php
+++ b/core/modules/system/tests/src/Functional/Form/FormTest.php
@@ -130,7 +130,7 @@ public function testRequiredFields() {
             $this->assertTrue(isset($errors[$element]), "Check empty($key) '$type' field '$element'");
             if (!empty($form_output)) {
               // Make sure the form element is marked as required.
-              $this->assertRegExp($required_marker_preg, (string) $form_output, "Required '$type' field is marked as required");
+              $this->assertMatchesRegularExpression($required_marker_preg, (string) $form_output, "Required '$type' field is marked as required");
             }
           }
           else {
diff --git a/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php b/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php
index e079606c3bde9846cae218e8806c372cb9fff678..6b4e9e72b35bad35f89c8abe6d16df116a6b1291 100644
--- a/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php
+++ b/core/tests/Drupal/FunctionalTests/Routing/PathEncodedTest.php
@@ -52,7 +52,7 @@ public function testAliasToEncoded() {
     foreach ($route_paths as $route_name => $path) {
       // The alias may be only a suffix of the generated path when the test is
       // run with Drupal installed in a subdirectory.
-      $this->assertRegExp('@/' . rawurlencode($aliases[$route_name]) . '$@', Url::fromRoute($route_name)->toString());
+      $this->assertMatchesRegularExpression('@/' . rawurlencode($aliases[$route_name]) . '$@', Url::fromRoute($route_name)->toString());
       $this->drupalGet(Url::fromRoute($route_name));
       $this->assertSession()->pageTextContains('PathEncodedTestController works');
     }
diff --git a/core/tests/Drupal/KernelTests/AssertContentTrait.php b/core/tests/Drupal/KernelTests/AssertContentTrait.php
index 60672f56dc470b58521a80baec7b397a2d915b06..4c54de3465107b13f0c8f2ddcd604befdc84273d 100644
--- a/core/tests/Drupal/KernelTests/AssertContentTrait.php
+++ b/core/tests/Drupal/KernelTests/AssertContentTrait.php
@@ -732,7 +732,7 @@ protected function assertPattern($pattern, $message = '', $group = 'Other') {
     if (!$message) {
       $message = new FormattableMarkup('Pattern "@pattern" found', ['@pattern' => $pattern]);
     }
-    $this->assertRegExp($pattern, $this->getRawContent(), $message);
+    $this->assertMatchesRegularExpression($pattern, $this->getRawContent(), $message);
     return TRUE;
   }
 
@@ -783,7 +783,7 @@ protected function assertTextPattern($pattern, $message = NULL, $group = 'Other'
     if (!isset($message)) {
       $message = new FormattableMarkup('Pattern "@pattern" found', ['@pattern' => $pattern]);
     }
-    $this->assertRegExp($pattern, $this->getTextContent(), $message);
+    $this->assertMatchesRegularExpression($pattern, $this->getTextContent(), $message);
     return TRUE;
   }
 
diff --git a/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php
index b8ed52a1a6c13bf1d16672e33b211ea0552e58b5..30afb792f333634bbfc5927d38831f618317f277 100644
--- a/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php
@@ -161,18 +161,18 @@ public function testDbDumpCommand() {
 
     // Table data is exported.
     $pattern = preg_quote("\$connection->insert('config')");
-    $this->assertRegExp('/' . $pattern . '/', $command_tester->getDisplay(), 'Table data is properly exported to the script.');
+    $this->assertMatchesRegularExpression('/' . $pattern . '/', $command_tester->getDisplay(), 'Table data is properly exported to the script.');
 
     // The test data are in the dump (serialized).
     $pattern = preg_quote(serialize($this->data));
-    $this->assertRegExp('/' . $pattern . '/', $command_tester->getDisplay(), 'Generated data is found in the exported script.');
+    $this->assertMatchesRegularExpression('/' . $pattern . '/', $command_tester->getDisplay(), 'Generated data is found in the exported script.');
 
     // Check that the user account name and email address was properly escaped.
     // cspell:disable-next-line
     $pattern = preg_quote('"q\'uote\$dollar@example.com"');
-    $this->assertRegExp('/' . $pattern . '/', $command_tester->getDisplay(), 'The user account email address was properly escaped in the exported script.');
+    $this->assertMatchesRegularExpression('/' . $pattern . '/', $command_tester->getDisplay(), 'The user account email address was properly escaped in the exported script.');
     $pattern = preg_quote('\'$dollar\'');
-    $this->assertRegExp('/' . $pattern . '/', $command_tester->getDisplay(), 'The user account name was properly escaped in the exported script.');
+    $this->assertMatchesRegularExpression('/' . $pattern . '/', $command_tester->getDisplay(), 'The user account name was properly escaped in the exported script.');
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
index efcfe0665129bbf6b5efba7853a0c4d0a4ec2a99..14a51290b2e26b96fb81338e301c6d6ec2fe91cc 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
@@ -113,7 +113,7 @@ public function testSiteUuidValidate() {
       $expected = static::FAIL_MESSAGE . PHP_EOL . 'Site UUID in source storage does not match the target storage.';
       $this->assertEquals($expected, $actual_message);
       foreach ($expected_error_log as $log_row) {
-        $this->assertRegExp("/$log_row/", $actual_message);
+        $this->assertMatchesRegularExpression("/$log_row/", $actual_message);
       }
     }
   }
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php
index a3361bd40fe2c59f74ee2fcfc5029a0b356ac6d5..b0cfc72804d42f84cf16adb2a1a24351eee0448c 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryAggregateTest.php
@@ -139,7 +139,7 @@ public function testAggregation() {
       // We need to check that a character exists before and after the table,
       // column and alias identifiers. These would be the quote characters
       // specific for each database system.
-      $this->assertRegExp('/' . $aggregation_function . '\(.entity_test.\..id.\) AS .id_' . $aggregation_function . './', (string) $query, 'The argument to the aggregation function should be a quoted field.');
+      $this->assertMatchesRegularExpression('/' . $aggregation_function . '\(.entity_test.\..id.\) AS .id_' . $aggregation_function . './', (string) $query, 'The argument to the aggregation function should be a quoted field.');
       $this->assertEquals($expected, $this->queryResult);
     }
 
diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
index bd7d48029e9bb27aff43a0fc03825031c8e60c30..a504aaecdd0fc05d12a710c89c8873aec6a1517f 100644
--- a/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
@@ -360,7 +360,7 @@ public function testLoadByProperties() {
         $this->fail($message);
       }
       catch (\InvalidArgumentException $e) {
-        $this->assertRegExp('/^An invalid property name, .+ was specified. Allowed property names are:/', $e->getMessage(), 'Found expected exception message.');
+        $this->assertMatchesRegularExpression('/^An invalid property name, .+ was specified. Allowed property names are:/', $e->getMessage(), 'Found expected exception message.');
       }
     }
     $this->addMenuLink('test_link.1', '', 'test', [], 'menu1');
diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
index ba0ed067189fdbc779bf78bea882cb418c7e90ba..ab4dff1f7fd77997bdc3749ce7c361b0d872b5b8 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
@@ -32,7 +32,7 @@ public function testSetUpBeforeClass() {
    * @covers ::bootEnvironment
    */
   public function testBootEnvironment() {
-    $this->assertRegExp('/^test\d{8}$/', $this->databasePrefix);
+    $this->assertMatchesRegularExpression('/^test\d{8}$/', $this->databasePrefix);
     $this->assertStringStartsWith('vfs://root/sites/simpletest/', $this->siteDirectory);
     $this->assertEquals([
       'root' => [
@@ -226,8 +226,8 @@ public function testRenderWithTheme() {
     $output = \Drupal::service('renderer')->renderRoot($build);
     $this->assertEquals('core', \Drupal::theme()->getActiveTheme()->getName());
 
-    $this->assertRegExp($expected, (string) $build['#children']);
-    $this->assertRegExp($expected, (string) $output);
+    $this->assertMatchesRegularExpression($expected, (string) $build['#children']);
+    $this->assertMatchesRegularExpression($expected, (string) $output);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Composer/ComposerTest.php b/core/tests/Drupal/Tests/Composer/ComposerTest.php
index 0eb4e227cdba486ca582fb2adfd28f18202518f4..710173072c9c3a1d4f10a40ea8438aee429a50cc 100644
--- a/core/tests/Drupal/Tests/Composer/ComposerTest.php
+++ b/core/tests/Drupal/Tests/Composer/ComposerTest.php
@@ -21,7 +21,7 @@ public function testEnsureComposerVersion() {
       $this->assertNull(Composer::ensureComposerVersion());
     }
     catch (\RuntimeException $e) {
-      $this->assertRegExp('/Drupal core development requires Composer 1.9.0, but Composer /', $e->getMessage());
+      $this->assertMatchesRegularExpression('/Drupal core development requires Composer 1.9.0, but Composer /', $e->getMessage());
     }
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php
index 5ab5316a4e50615b702c3a2d052f3cfd17ac3120..8074e53d9d8b84d986e4a2e1f02107f0c8225e2d 100644
--- a/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php
+++ b/core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php
@@ -55,7 +55,7 @@ public function testGetLockId() {
     $lock_id = $this->lock->getLockId();
     $this->assertIsString($lock_id);
     // Example lock ID would be '7213141505232b6ee2cb967.27683891'.
-    $this->assertRegExp('/[\da-f]+\.\d+/', $lock_id);
+    $this->assertMatchesRegularExpression('/[\da-f]+\.\d+/', $lock_id);
     // Test the same lock ID is returned a second time.
     $this->assertSame($lock_id, $this->lock->getLockId());
   }
diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
index 29720cd2b2aa45524e3fe490ef8af3d0bc781041..8fffaac69dccfdc075b1e49606ba9773ef2dad6a 100644
--- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
+++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
@@ -78,7 +78,7 @@ public function testToString() {
     restore_error_handler();
 
     $this->assertEquals(E_USER_ERROR, $this->lastErrorNumber);
-    $this->assertRegExp('/Exception thrown while calling __toString on a .*Mock_TranslatableMarkup_.* object in .*TranslatableMarkupTest.php on line [0-9]+: Yes you may./', $this->lastErrorMessage);
+    $this->assertMatchesRegularExpression('/Exception thrown while calling __toString on a .*Mock_TranslatableMarkup_.* object in .*TranslatableMarkupTest.php on line [0-9]+: Yes you may./', $this->lastErrorMessage);
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php
index 4b9ad67d3cb336bbe082d6fae13ebf511bc1f643..ec34f8fb77820d9867d47265b17872a6368add0f 100644
--- a/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php
+++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php
@@ -71,7 +71,7 @@ function ($unescaped_test_classnames, $phpunit_file, &$status) {
    */
   public function testPhpUnitCommand() {
     $runner = new PhpUnitTestRunner($this->root, sys_get_temp_dir());
-    $this->assertRegExp('/phpunit/', $runner->phpUnitCommand());
+    $this->assertMatchesRegularExpression('/phpunit/', $runner->phpUnitCommand());
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
index 905560b34bf8390d08e49aaa8770b996e18ec139..bb838e6c608baa60404060d6f50e464bd9b9d81e 100644
--- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
@@ -126,7 +126,6 @@ public static function getSkippedDeprecations() {
       // PHPUnit 9.
       "The \"PHPUnit\TextUI\DefaultResultPrinter\" class is considered internal This class is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from \"Drupal\Tests\Listeners\HtmlOutputPrinter\".",
       'assertFileNotExists() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileDoesNotExist() instead.',
-      'assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead.',
       'assertNotRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertDoesNotMatchRegularExpression() instead.',
       'Support for using expectException() with PHPUnit\\Framework\\Error\\Warning is deprecated and will be removed in PHPUnit 10. Use expectWarning() instead.',
       'Support for using expectException() with PHPUnit\\Framework\\Error\\Error is deprecated and will be removed in PHPUnit 10. Use expectError() instead.',
diff --git a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php
index 5b70e5f4ba0de2af46e321b352036cda8fa24727..5c6313929583c12d1bd663656aaa9f665677cfaf 100644
--- a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php
+++ b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php
@@ -152,7 +152,7 @@ public function testInstallScript() {
     $this->assertStringContainsString('Successfully installed a test site', $process->getOutput());
     $this->assertSame(0, $process->getExitCode());
     $regex = '/Database prefix\s+([^\s]*)/';
-    $this->assertRegExp($regex, $process->getOutput());
+    $this->assertMatchesRegularExpression($regex, $process->getOutput());
     preg_match('/Database prefix\s+([^\s]*)/', $process->getOutput(), $matches);
     $other_db_prefix = $matches[1];
     $other_key = $this->addTestDatabase($other_db_prefix);