From cc5d8e934a6c1478eeba1edf0f1d5c73304896a7 Mon Sep 17 00:00:00 2001 From: Kiran Hart Date: Tue, 23 Jan 2024 14:48:58 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9D=8C=20fix=20regex=20quote=20issue,=20clos?= =?UTF-8?q?es=20#84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Took 1 minute --- src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java index 5671c84..3f43dd9 100644 --- a/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java +++ b/src/main/java/ca/tweetzy/auctionhouse/api/AuctionAPI.java @@ -333,7 +333,8 @@ public class AuctionAPI { } public boolean matchSearch(String pattern, String sentence) { - Pattern patt = Pattern.compile(ChatColor.stripColor(pattern), Pattern.CASE_INSENSITIVE); + String escapedPattern = Pattern.quote(ChatColor.stripColor(pattern)); + Pattern patt = Pattern.compile(escapedPattern, Pattern.CASE_INSENSITIVE); Matcher matcher = patt.matcher(sentence); return matcher.find(); }