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




**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************