On Tue, Oct 4, 2011 at 21:40, André Warnier <a...@ice-sa.com> wrote: [...] >> > I am not sure that I follow the depths of the Java implementation of all of > this, but please note that "\.googlebot\.com$" is a regexp /anchored/ at the > end of the string. > In other words, I would be surprised (and disappointed) if this did not > match the hostnames "bot1.googlebot.com" and "bot123.bots.googlebot.com"
It's quite simple really: .matches(), which is used, anchors the regex at the beginning and end. .matches("re") is equivalent to .lookingAt("^re$"), even if your re is already anchored. Unfortunately, this method's misleading name and the prevalence of Java has led a lot of people to believe that regex matching was done on the whole input, which is of course false. -- Francis Galiegue ONE2TEAM Ingénieur système Mob : +33 (0) 683 877 875 Tel : +33 (0) 178 945 552 f...@one2team.com 40 avenue Raymond Poincaré 75116 Paris --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org