Input Text Mask
-
Hey all I have a textbox with a max length of 5 the first three chars must be uppercase letters between [A-Z] the final two chars must be between [0-9] I am trying to do this as a regex function in the onChange Event using Javascript, but my Regular Expressions aren't very good. currently I split the textbox.text into two string variables
str1 = orgID.substr(0,3); // first three chars str2 = orgID.substr(4,5); // last two chars
Then I run a (very) simple regex expression on each of these substrings. How would I do this formatting without breaking orgID into 2 substrings? Thanks for help Jason -- modified at 20:23 Monday 10th April, 2006 -
Hey all I have a textbox with a max length of 5 the first three chars must be uppercase letters between [A-Z] the final two chars must be between [0-9] I am trying to do this as a regex function in the onChange Event using Javascript, but my Regular Expressions aren't very good. currently I split the textbox.text into two string variables
str1 = orgID.substr(0,3); // first three chars str2 = orgID.substr(4,5); // last two chars
Then I run a (very) simple regex expression on each of these substrings. How would I do this formatting without breaking orgID into 2 substrings? Thanks for help Jason -- modified at 20:23 Monday 10th April, 2006 -
Hey all I have a textbox with a max length of 5 the first three chars must be uppercase letters between [A-Z] the final two chars must be between [0-9] I am trying to do this as a regex function in the onChange Event using Javascript, but my Regular Expressions aren't very good. currently I split the textbox.text into two string variables
str1 = orgID.substr(0,3); // first three chars str2 = orgID.substr(4,5); // last two chars
Then I run a (very) simple regex expression on each of these substrings. How would I do this formatting without breaking orgID into 2 substrings? Thanks for help Jason -- modified at 20:23 Monday 10th April, 2006 -
I am not sure what you exactly want, but if you only want to test the format of the string you can use:
var re = /[A-Z]{3}\d{2}/; if(re.test(orgID)) { ... }
Wout Louwers