Search Results

Search found 1 results on 1 pages for 'oneofthelions'.

Page 1/1 | 1 

  • Regex doesn't work properly

    - by oneofthelions
    I am trying to implement a regular expression to allow only one or two digits after a hyphen '-' and it doesn't work properly. It allows as many digits as user types after '-' Please suggest my ExtJS Ext.apply(Ext.form.VTypes, { hyphenText: "Number and hyphen", hyphenMask: /[\d\-]/, hyphenRe: /^\d+-\d{1,2}$/, hyphen: function(v){ return Ext.form.VTypes.hyphenRe.test(v); } }); //Input Field for Issue no var <portlet:namespace/>issueNoField = new Ext.form.TextField({ fieldLabel: 'Issue No', width: 120, valueField:'IssNo', vtype: 'hyphen' }); This works only to the limit that it allows digits and -. But it also has to allow only 1 to 2 digits after - at most. Is something wrong in my regex? hyphenRe: /^\d+-\d{1,2}$/,

    Read the article

1