diff --git a/package.json b/package.json index 17ed0b96..50c7936d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "battery-state-card", - "version": "1.5.1", + "version": "1.5.2", "description": "Battery State card for Home Assistant", "main": "dist/battery-state-card.js", "repository": { diff --git a/src/battery-provider.ts b/src/battery-provider.ts index 78876072..8a901a93 100644 --- a/src/battery-provider.ts +++ b/src/battery-provider.ts @@ -33,7 +33,7 @@ const operatorHandlers: { [key in FilterOperator]: (val: string | number | undef // create regexp after removing slashes exp = new RegExp(pattern.substr(1, pattern.length - 2)); } else if (pattern.indexOf("*") != -1) { - exp = new RegExp(pattern.replace(/\*/g, ".*")); + exp = new RegExp("^" + pattern.replace(/\*/g, ".*") + "$"); } return exp ? exp.test(val.toString()) : val === pattern; diff --git a/src/utils.ts b/src/utils.ts index af024ead..9dc03057 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,7 +1,7 @@ import { HomeAssistant } from "./ha-types"; console.info( - "%c BATTERY-STATE-CARD %c 1.5.1", + "%c BATTERY-STATE-CARD %c 1.5.2", "color: white; background: forestgreen; font-weight: 700;", "color: forestgreen; background: white; font-weight: 700;", );