正則表達式模式我不太好。 我必須把驗證上的弦,允許正則表達式允許使用字母,數字,小數點,空格和下劃線
only alphabets, numbers, decimals, spaces, comma and underscore
允許的字母和空格我有/^[a-zA-Z][a-zA-Z\\s]+$/
請幫我在一個模式建立上述所有條件。
感謝
正則表達式模式我不太好。 我必須把驗證上的弦,允許正則表達式允許使用字母,數字,小數點,空格和下劃線
only alphabets, numbers, decimals, spaces, comma and underscore
允許的字母和空格我有/^[a-zA-Z][a-zA-Z\\s]+$/
請幫我在一個模式建立上述所有條件。
感謝
你可以試試:
/^[\w., ]+$/
我不知道什麼是對原料碳的要求,如果有任何。
+1爲及時回覆,會檢查並通知您,謝謝您的回答。 –
拉胡爾的回答給了我思考的方向,但對於遊客,可能這也可以是有益的
patternForClasName = /^([a-zA-Z0-9 _]+\.)*[a-zA-Z0-9 _]+$/;
// Allowing valid className which has a format abcsasa.dsd.dsd(the class or a package name can have an underscore or a numerical)
patternForName = /^([a-zA-Z0-9 _-]+)$/;
// Allowing alphanumeric + spaces + (_)underscore and a (-)dash
patternForDescription = /^([a-zA-Z0-9 _-]+[\,\.]+)*[a-zA-Z0-9 _-]*$/;
// Allowing alphanumeric,spaces, (_)underscore, (-)dash, comma, decimal
patternURLFormat = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
// For a valid URL
不知道爲什麼你添加一個jQuery標籤......而這也正是數字之間的差異小數點。 – PhiLho
是「小數點」的小數點嗎?我添加了它,以防萬一。 – PhiLho