URIからUUIDを抽出し、これまで50%成功している必要があります。Java正規表現を使用してURIからUUIDを抽出する方法
public static final String SWAGGER_BASE_UUID_REGEX = ".*?(\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12})(.*)?";
public static final String abc="https://127.0.0.1:9443/api/am/store/v0.10/apis/058d2896-9a67-454c-95fc-8bec697d08c9/documents/058d2896-9a67-454c-9aac-8bec697d08c9";
public static void main(String[] args) {
Pattern pairRegex = Pattern.compile(SWAGGER_BASE_UUID_REGEX);
Matcher matcher = pairRegex.matcher(abc);
if (matcher.matches()) {
String a = matcher.group(1);
String b = matcher.group(2);
System.out.println(a+ " ===========> A");
System.out.println(b+ " ===========> B");
}
}
私は現在取得しています出力は、今私がBからの出力はちょうど
058d2896-9a67-454c-9aac-8bec697d08c9
任意のヘルプは高く評価されるだろうようにしたい
058d2896-9a67-454c-95fc-8bec697d08c9 ===========> A
/documents/058d2896-9a67-454c-9aac-8bec697d08c9 ===========> B
です!ありがとう
これはうまく説明してくれてありがとう。 – Infamous