[rules-users] Removing Special Characters

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jan 3 09:28:00 EST 2012


On 3 January 2012 14:49, Swindells, Thomas <TSwindells at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120103/a8db6ba5/attachment.html 


More information about the rules-users mailing list