item-mixin: Improve Item name validation RegEx (#2658)
`A-z` also matches `[ \ ] ^ _ `, which is not intended. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>pull/2660/head
parent
2d07d21ebb
commit
553591d72c
|
@ -39,7 +39,7 @@ export default {
|
|||
* @returns {string} The error message if the name is invalid, or an empty string if the name is valid.
|
||||
*/
|
||||
validateItemName (name) {
|
||||
if (!/^[A-z][A-z0-9_]*$/.test(name)) {
|
||||
if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(name)) {
|
||||
return 'Required. Must not start with a number. A-Z,a-z,0-9,_ only'
|
||||
} else if (this.items && this.items.some(item => item.name === name)) {
|
||||
return 'An Item with this name already exists'
|
||||
|
|
Loading…
Reference in New Issue