0

We have a field in GUI screen like which is nullable in DB , It should accept null values from UI page, if we give any values other than numbers or decimals it should display error "Enter numeric values".

Now the problem is if I didn’t give any value in that field it is storing null value in DB in my local windows system(i.e. when I run the application locally using Tomcat Server), after deploying in Weblogic server (which is running on Linux machine) if I try to insert null values into that field I am getting error "Enter numeric values", for validations

I have used below regular expression

^[1-9]\\d*(\\.\\d+)?$
Welbog
  • 59,154
  • 9
  • 110
  • 123
Raj
  • 2,463
  • 10
  • 36
  • 52
  • It's impossible for that regular expression to match the empty string because of the [1-9] part. By "null values" do you mean the empty string? Perhaps the value is null locally and the empty string on the server. – Welbog Jun 27 '16 at 15:15
  • A valid entry would be `^([1-9]\\d*(\\.\\d+)?|0(\\.\\d+)?|)$` maybe: the original pattern, 0 / 0.123 or empty. That empty was not validated locally smells indeed of some other form/field setting, of which I know nothing. – Joop Eggen Jun 27 '16 at 15:24
  • @ Welog. yes I mean its empty string.. – Raj Jun 27 '16 at 15:26

1 Answers1

-1

Its the problem with Mathcher in Regular Expression. Actually we have java version 1.7 in our local and 1.6 in server. I looked up on google and came to know that there is a bug in Mathcer.

Here is the one of the link from Stackoverflow which discussed the same

Bug in Java regex implementation?

Thanks,

Raj

Raj
  • 2,463
  • 10
  • 36
  • 52