Allow item names to start with an underscore (#2958)

Reported in
https://community.openhab.org/t/openhab-4-3-item-name-starting-with-underscore/161244

Regression from #2658

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
pull/2959/head
jimtng 2025-01-01 00:31:09 +10:00 committed by GitHub
parent 512ecce304
commit 2028872bfc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -44,7 +44,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-Za-z][A-Za-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'