On 3 January 2012 14:49, Swindells, Thomas <span dir="ltr"><<a href="mailto:TSwindells@nds.com" target="_blank">TSwindells@nds.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left:1px solid rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
It will work</blockquote><div><br>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.<br><br> <br></div>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Rule "Wild char validation"<br>
When<br>
c: CustomerInfo(name : customerName matches ".*([\*#].*") //any string containing a * or a #<br></blockquote><div><br>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 '\\'.<br>
</div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
then<br>
modify(c) {<br>
setCustomerName(name.replaceAll("[\*#]", "")); //replace any * or # with ""<br>
}<br>
end<br></blockquote><div><br>Same here: either no '\' or doubled.<br> <br>-W<br><br><br>
</div></div>