Java negative bigdecimal value with braces
<p>I have a string that I'm trying to parse into a BigDecimal. I'm using the following regex to strip all non currency symbols with the exception of -,.()$. Once it has been stripped, I'm then trying to create a BigDecimal with the remaining value. The problem begins when a negative value comes across in brackets. Does anybody have any suggestions on how to repair this instance?</p>

<pre><code>(1000.00) fails
</code></pre>

<p>I'm assuming I must somehow convert the brackets to a negative sign. </p>

<p>code sample. </p>

<pre><code>public BigDecimal parseClient(Field field, String clientValue, String message) throws ValidationException {
    if (clientValue == null) {
        return null;
    }

    try {
        clientValue = clientValue.replaceAll( "[^\\d\\-\\.\\(\\)]", "" );
        return new BigDecimal(clientValue.toString());
    } catch (NumberFormatException ex) {
        throw new ValidationException(message);
    }
}
</code></pre>
