regex - Javascript reg ex combination -


  var cost_price = "15..00" / * Cost value should be such that there should be numbers and one Do not have more points than * / if (/ ^ ([0-9]). ([.]) /. Exam (cost_price) {documet.write ("true cost value"); }   

Now let me get the Hello message despite two points in cost_price if I should change in the condition?

P.S. I have 2 reg pre-combined one to see if the dot happens only once, checks for the accuracy of points and other investigations.

why not

  / ^ [0-9] + (\ [0- 9] +)? $ /   

And so make the final part completely optional? (? specifies " 0 to 1 times ") "

 regular expression view

If you want to allow .15 , you first have to [0-9] + < / Code> (1 coincides with an infinite time) from [0-9] * (corresponds to 0 for eternity).

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -