From 1a0d721b807c4b0efdba96e503f56eeb4657a789 Mon Sep 17 00:00:00 2001 From: psilabs <113860476+psilabs-dev@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:32:09 -0800 Subject: [PATCH] make regex not greedy (#1126) --- lib/LANraragi/Model/Search.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/LANraragi/Model/Search.pm b/lib/LANraragi/Model/Search.pm index 7ee39f5b9..e1cf561eb 100644 --- a/lib/LANraragi/Model/Search.pm +++ b/lib/LANraragi/Model/Search.pm @@ -408,7 +408,7 @@ sub sort_results( $sortkey, $sortorder, @filtered ) { # For other tags, we use the first tag we found that matches the sortkey/namespace. # (If no tag, defaults to "zzzz") - %tmpfilter = map { $_ => ( $redis->hget( $_, "tags" ) =~ m/.*${re}:(.*)(\,.*|$)/ ) ? $1 : "zzzz" } @filtered; + %tmpfilter = map { $_ => ( $redis->hget( $_, "tags" ) =~ m/.*${re}:(.*?)(\,.*|$)/ ) ? $1 : "zzzz" } @filtered; # Read comments from the bottom up for a better understanding of this sort algorithm. @sorted = map { $_->[0] } # Map back to only having the ID