[英]Regular expression to match start of an address
我想匹配java中地址的開頭。 我已經嘗試過使用該網站( http://www.regexplanet.com/advanced/java/index.html ),它確實匹配了地址,但是我在netbean中嘗試的那一刻卻沒有。 知道為什么嗎?
Pattern p = Pattern.compile("\bcloud.*");
Matcher m = p.matcher("cloud (cloud.yahoo.com:225) - v0.00014 ( jan 10 1999 / 24:12:56 )");
System.out.println(m.matches());
\\
應該轉義。 否則, \\b
被解釋為BACKSPACE而不是word boundary 。
Pattern p = Pattern.compile("\\bcloud.*");
// ^^^
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.