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+)?$
3
  • 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. Commented Jun 27, 2016 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. Commented Jun 27, 2016 at 15:24
  • @ Welog. yes I mean its empty string.. Commented Jun 27, 2016 at 15:26

1 Answer 1

-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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.