<?php namespace App\Util; class Regex { /** @return list<string> */ public static function match(string $pattern, string $subject): array { $matches = []; \Safe\preg_match($pattern, $subject, $matches); assert(is_array($matches)); return $matches; } public static function replace(string $pattern, string $replacement, string $subject, int $limit = -1): string { $result = \Safe\preg_replace($pattern, $replacement, $subject, $limit); assert(is_string($result)); // cannot be otherwise when the parameters are strings return $result; } }
You have javascript disabled. You will not be able to edit any code.