[opencms-dev] regex

Paoletti Corrado c.paoletti at fineco.it
Mon Dec 1 16:01:08 CET 2014


Hi,
maybe I'm OT... but I do not understand where I'm wrong.

I've created a jsp

<%@ page session="false" %>
<%@ page import="org.opencms.jsp.*, java.util.*"%>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<%
String test = "clienti -solotesto";
out.println( "1) " + test.matches("\\bclienti\\b") );

test = "clientilogos -solotesto";
out.println( "2) " + test.matches("\\bclientilogos\\b") );
%>

What I want is to find whole words "clienti" and "clientilogos" within a string. Both lines return false while http://www.regexr.com/ says I should have two true!

Many thanks and sorry for this newbie question ;-)

Corrado




More information about the opencms-dev mailing list