AspireCloud/app/Utils/Regex.php
Chuck Adams 165fbe3cbd
Smarter and faster plugin and themes searching (#169)
* feat: use UNION ALL queries in applySearch

* feat: add and use trigram indexes

* fix: uniq results by slug so at least each page has unique results
2025-02-21 14:20:52 -07:00

24 lines
544 B
PHP

<?php
namespace App\Utils;
class Regex
{
/** @return string[] */
public static function match(string $pattern, string $subject): array
{
$matches = [];
\Safe\preg_match($pattern, $subject, $matches);
return $matches;
}
public static function replace(string $pattern, string $replacement, string $subject, int $limit = -1): string
{
return \Safe\preg_replace($pattern, $replacement, $subject, $limit);
}
private function __construct()
{
// not instantiable
}
}