Skip to content

Commit

Permalink
正規表現の変更とmatches()に変更
Browse files Browse the repository at this point in the history
  • Loading branch information
shiro8613 committed Feb 3, 2024
1 parent 239f39b commit 9f8e90e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}|"
Expand All @@ -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();
});


Expand Down

0 comments on commit 9f8e90e

Please sign in to comment.