title: Java Decimal Format - as much precision as given
body: <p>I'm working with <code>DecimalFormat</code>, I want to be able to read and write decimals with as much precision as given (I'm converting to <code>BigDecimal</code>). </p>
  
  <p>Essentially, I want a <code>DecimalFormat</code> which enforces the following pattern "\d+(\.\d+)?" i.e. "at least one digit then, optionally, a decimal separator followed by at least one digit".</p>
  
  <p>I'm struggling to be able to implement this using <code>DecimalFormat</code>, I've tried several patterns but they seem to enforced fixed number of digits. </p>
  
  <p>I'm open to alternative ways of achieving this too.</p>
  
  <p>Edit:</p>
  
  <p>For a little more background, I'm parsing user-supplied data in which decimals could be formatted in any way, and possibly not in the locale format. I'm hoping to let them supply a decimal format string which I can use the parse the data. </p>