Skip to content

JSON Table and Device Counter Widget Icon Replacements

Sebastian Bormann edited this page Jan 20, 2022 · 1 revision

JSON-Table-Widget and Device-Counter-Widget - Icon Replacements

By setting icon-replacements you can define values, that will be replaced by icons. This way you could for example replace the values "true" and "false" by corresponding icons.

For every Icon-Replacement you have 3 things to set:

  • Icon: Chose the icon
  • Caption that will be added to icon: This string will be added after the icon
  • Search-String: This is the string that is searched for and that will be replaced by the icon and the caption

Using regular expressions (RegEx)

By using regular expressions, you can use very complex search patterns. Google will help you. Here are some examples for search-strings:

  • [1-9][0-9]?%: This will search vor values between 1% and 99%
    • Explanation:
      • [1-9] search for the characters 1-9 - this ensures, values <1 are ignored
      • [0-9]? followed by 0-9, but only 0-1 times (this is marked by the ?) - this ensures, that values >99 are ignored
      • % followed by the caracter %
  • ^[1-9][0-9]?%$: This will search vor values between 1% and 99%, but only if nothing else preceedes or follows this value
    • Explanation:
      • ^ means, search only at the beginning of the regEx and $ at the end

You can also use variables in the caption:

  • $$: this represents the character $
  • $&: this represents the found search-string
  • $`: this represents the string before the search-string
  • $': this represents the string after the search-string