From 9f8e90e4128fd49af76c50a48e6d097ee9f2f7e9 Mon Sep 17 00:00:00 2001 From: toms0910 Date: Sat, 3 Feb 2024 18:41:19 +0900 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E8=A6=8F=E8=A1=A8=E7=8F=BE=E3=81=AE?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=81=A8matches()=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dev/felnull/itts/core/dict/AbbreviationDictionary.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/dev/felnull/itts/core/dict/AbbreviationDictionary.java b/core/src/main/java/dev/felnull/itts/core/dict/AbbreviationDictionary.java index d722c27..d0bac27 100644 --- a/core/src/main/java/dev/felnull/itts/core/dict/AbbreviationDictionary.java +++ b/core/src/main/java/dev/felnull/itts/core/dict/AbbreviationDictionary.java @@ -35,9 +35,9 @@ public class AbbreviationDictionary implements Dictionary { return matcher.find(); }) .addOption(1, "アイピーブイフォーショウリャク", s -> { - Pattern pattern = Pattern.compile("(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])"); + Pattern pattern = Pattern.compile("^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$"); Matcher matcher = pattern.matcher(s); - return matcher.find(); + return matcher.matches(); }) .addOption(1, "アイピーブイロクショウリャク", s -> { Pattern pattern = Pattern.compile("(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|" @@ -53,7 +53,7 @@ public class AbbreviationDictionary implements Dictionary { + "(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|" + "(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))"); Matcher matcher = pattern.matcher(s); - return matcher.find(); + return matcher.matches(); });