Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: "Tony" Newsgroups: comp.lang.javascript Subject: How can I validate this with regular expression Date: Thu, 17 Jan 2013 12:29:22 +0100 Organization: A noiseless patient Spider Lines: 1 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Injection-Date: Thu, 17 Jan 2013 11:29:23 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="04290fff4557273ca84c3ad616751e0b"; logging-data="6960"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1RDAYCq5ujZg9lXA1gie/KRr5AFm8+b4=" X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3555.308 X-Newsreader: Microsoft Windows Live Mail 15.4.3555.308 Importance: Normal Cancel-Lock: sha1:ixdku3d5Ox3NWVdjyvheo3Q5s/s= X-Priority: 3 X-MSMail-Priority: Normal Xref: csiph.com comp.lang.javascript:18123 Hello! I'm new to JavaScript and JQuery. Have earlier worked with ASP.NET. I have this html input I have written this addMethod that should validate the format but I have two questions. 1. Where should this be put. 2.When will this be called As I said this is new to me. $.validator.addMethod('txtDepthBow', function (value) { return /^(\d{1,2}(\.d{1,2})?)$/.test(value); }, 'Wrong input.'); //Tony