Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
120
rated 0 times [  127] [ 7]  / answers: 1 / hits: 106295  / 13 Years ago, wed, september 14, 2011, 12:00:00

I don't really know much about regex at all, but if someone could help me change the following code to also allow for lowercase a-z, that would be great!



$(input.code).keyup(function(){
this.value = this.value.match(/[A-Z]{3}([0-9]{1,4})?|[A-Z]{1,3}/)[0];
});

More From » regex

 Answers
17

If you want a regular expression to be case-insensitive, add a i modifier to the end of the regex. Like so:



/[A-Z]{3}([0-9]{1,4})?|[A-Z]{1,3}/i

[#90109] Monday, September 12, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kylanalis

Total Points: 438
Total Questions: 85
Total Answers: 102

Location: Barbados
Member since Sun, Nov 27, 2022
1 Year ago
kylanalis questions
Sat, Oct 2, 21, 00:00, 3 Years ago
Tue, Oct 13, 20, 00:00, 4 Years ago
Thu, Feb 13, 20, 00:00, 4 Years ago
Tue, Jan 7, 20, 00:00, 4 Years ago
;