OSDN Git Service

動画IDのパターンを一箇所にまとめる
[coroid/inqubus.git] / frontend / src / yukihane / Util.java
index bb678fd..31e711e 100644 (file)
@@ -1,8 +1,9 @@
 /* $Id$ */
 package yukihane;
 
+import static yukihane.inqubus.InqubusConstants.*;
+
 import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 /**
  * nicobrowser.util.Utilより, 必要なものをピックアップしたクラス.
@@ -33,8 +34,7 @@ public final class Util {
     public static String getVideoId(final String alterId) {
         final int startIdIdx = alterId.lastIndexOf("/") + 1;
         final String altId = alterId.substring(startIdIdx);
-        final Pattern idPattern = Pattern.compile("([a-z]*\\d+)");
-        final Matcher idMatcher = idPattern.matcher(altId);
+        final Matcher idMatcher = PATTERN_VIDEO_ID.matcher(altId);
         if (!idMatcher.find()) {
             throw new IllegalArgumentException("URL/IDの指定が不正です: " + alterId);
         }