Good points – hopefulyl the gist of what I was suggesting came across – I like to leave debugging what I spew out as an exercise for the reader….
From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
On Behalf Of Wolfgang Laun
Sent: 03 January 2012 14:28
To: Rules Users List
Subject: Re: [rules-users] Removing Special Characters
On 3 January 2012 14:49, Swindells, Thomas <TSwindells@nds.com> wrote:
It will work
Not the way it was posted. At least, StringBuffer.setCharAt() needs a second argument of type char, and this would be a strange type for a "customer name" field.
Rule "Wild char validation"
When
c: CustomerInfo(name : customerName matches ".*([\*#].*") //any string containing a * or a #
There's a syntax error here, use ".*[*#].*", because you don't need to quote '*' inside '[...]', and if you do (which is OK) you'll have to use '\\'.
then
modify(c) {
setCustomerName(name.replaceAll("[\*#]", "")); //replace any * or # with ""
}
end
Same here: either no '\' or doubled.
-W