From 8889a16bdcee52506e75614ad1040d8951037bff Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 10 May 2021 00:09:12 +0200 Subject: [PATCH] Fixed regex-generation --- .../LinkedBeaconTeleporterManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterManager.java b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterManager.java index 14d9501..883428a 100644 --- a/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterManager.java +++ b/src/main/java/eu/ruekov/ruakij/LinkedBeaconTeleporters/linkedBeaconTeleporter/LinkedBeaconTeleporterManager.java @@ -140,10 +140,13 @@ public class LinkedBeaconTeleporterManager { String regex = serialiseBeaconItem(name, lore); // Wrap in regex-quotes - regex = "\\Q"+ regex +"\\E"; + regex = "^\\Q"+ regex +"\\E$"; // Exclude id from regex-quotes and create group regex = regex.replace("%id%", "\\E(.*)\\Q"); + // Remove empty regex-quotes + regex = regex.replace("\\E\\Q", ""); + return regex; } String serialiseBeaconItem(String name, List lore){