mirror of
https://gh.wpcy.net/https://github.com/aspirepress/AspireCloud.git
synced 2026-05-31 00:04:27 +08:00
* 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
24 lines
544 B
PHP
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
|
|
}
|
|
}
|