2013年9月13日星期五

Regex problem ~ students look

Text boxes & $ $ $ loginName & $ $ $ username | $ $ $ password box & $ $ $ userPassword & $ $ $ password | $ $ $ login button & $ $ $ http://192.168.10.251: 8080/app/login.do? realmId = 1330504872002 & $ $ $ landed url

want to get http://192.168.10.251:8080/app/login.do?realmId=1330504872002

seeking regular ~ tks

------ Solution ------------------------------------ --------
(? <= \ \ $ \ \ $ \ \ $) http://. * (? = \ \ &)
------ For reference only ---------------------------------------
text box & $ $ $ loginName & $ $ $ username | $ $ $ password box & $ $ $ userPassword & $ $ $ password | $ $ $ login button & $ $ $ http://192.168.10.251:8080/app/login. do? realmId = 1330504872002 & $ $ $ landed url

The above is the entire string information from brush option
------ For reference only ------------------------ ---------------

	public static void main(String[] args) {
String str = "文本框&$$$loginName&$$$用户名|$$$密码框&$$$userPassword&$$$密码|$$$登录按钮&$$$http://192.168.10.251:8080/app/login.do?realmId=1330504872002&$$$登陆url";
Pattern pattern = Pattern.compile("h.*2");
Matcher matcher = pattern.matcher(str);
if (matcher.find()) {
System.out.println(matcher.group());
}
}

------ For reference only ----------------------------------- ----


can explain not ah ~
------ For reference only ---------------------------- -----------
(? = \ \ &) and ( ? < = \ \ $ \ \ $ \ \ $ ) who these two expressions to explain ~
------ For reference only ---------------------------------- -----

(? = \ \ &) in the string to match before &
(? <= \ \ $ \ \ $ \ \ $) to match the string in $ $ $ , the \ \ is an escape
------ For reference only ---------------------------------------

(? = \ \ & ) in the string to match before &   
(? <= \ \ $ \ \ $ \ \ $) to match the string in $ $ $ , the \ \ is an escape  

ashamed. . Zero-width assertion write less, Leng Shimo understand at first glance . .
wrote about himself :
(? <= & \ $ \ $ \ $) http://.+ (? = & \ $ \ $ \ $)
------ For reference only - -------------------------------------

(? = \ \ & ;) in the string to match before &     
(? <= \ \ $ \ \ $ \ \ $) to match the string in $ $ $ , the \ \ is an escape          
  
ashamed. . Zero-width assertion write less, Leng Shimo understand at first glance . .   
wrote about himself :   
(? <= & \ $ \ $ \ $) http://.+ (? = & \ $ \ $ \ $)  

almost forgot zero-width assertion , and cough . .

没有评论:

发表评论