Java regex non-capturing group "?:"

  1. see: http://stackoverflow.com/questions/3512471/non-capturing-group
  2. usage: 
    (?:http|ftp)://([^/\r\n]+)(/[^\r\n]*)?
  3. Match "http://stackoverflow.com/"
         Group 1: "stackoverflow.com"
         Group 2: "/"
    
    Match "http://stackoverflow.com/questions/tagged/regex"
         Group 1: "stackoverflow.com"
         Group 2: "/questions/tagged/regex"
posted @ 2013-10-22 01:53  wxwcase  阅读(288)  评论(0编辑  收藏  举报