[英]What is the Regular Expression to match the space between two words (lower case and upper case)
[英]How can I make a regular expression match upper and lower case?
我對regex的了解並不多,但是如果有人可以幫助我更改以下代碼以允許使用小寫的az,那就太好了!
$("input.code").keyup(function(){
this.value = this.value.match(/[A-Z]{3}([0-9]{1,4})?|[A-Z]{1,3}/)[0];
});
如果希望正則表達式不區分大小寫,請在正則表達式的末尾添加一個i
修飾符 。 像這樣:
/[A-Z]{3}([0-9]{1,4})?|[A-Z]{1,3}/i
/[A-Za-z]{3}([0-9]{1,4})?|[A-Za-z]{1,3}/
[]
表示字符類, AZ
是允許的范圍,表示ABCDEFGHIJKLMNOPQRSTUVWXYZ。 您可以通過添加az
輕松擴展此功能
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.