We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8dd4ebd commit 836ad06Copy full SHA for 836ad06
src/Icons/src/Twig/IconFinder.php
@@ -35,11 +35,14 @@ public function icons(): array
35
{
36
$found = [];
37
38
+ // https://regex101.com/r/WGa4iF/1
39
+ $token = '[a-z0-9]+(?:-[a-z0-9]+)*';
40
+ $pattern = "#(?:'$token:$token')|(?:\"$token:$token\")#i";
41
+
42
foreach ($this->files($this->twig->getLoader()) as $file) {
43
$contents = file_get_contents($file);
-
- if (preg_match_all('#["\']([\w:-]+)["\']#', $contents, $matches)) {
- $found[] = $matches[1];
44
+ if (preg_match_all($pattern, $contents, $matches)) {
45
+ $found[] = array_map(fn ($res) => trim($res, '"\''), $matches[0]);
46
}
47
48
0 commit comments