以下的正則表達式給我java.lang.IllegalStateException: No match found
錯誤Java的正則表達式不匹配發現錯誤
String requestpattern = "^[A-Za-z]+ \\/+(\\w+)";
Pattern p = Pattern.compile(requestpattern);
Matcher matcher = p.matcher(requeststring);
return matcher.group(1);
,其中請求字符串是
POST //upload/sendData.htm HTTP/1.1
任何幫助,將不勝感激。
'\ w'(字符)被'[A-ZA-Z0-9_]'。它不會匹配「'/'','''''」或「'/'」(它們全都出現在「''''」之後)。 – acdcjunior 2013-05-02 17:26:54
我期待它給上傳作爲輸出 – Ananda 2013-05-02 18:33:47
[「使用匹配器組方法時找不到匹配項」的可能重複](http://stackoverflow.com/questions/5674268/no-match-found-when-using-matchers -group-method) – anotherdave 2014-06-10 11:57:02