The “Expressions” Tab provides enough information and examples to manage most of every day’s use. For those who want to go further we provide this additional information here. For the purposes of Big6 you need to apply the RegEx over the incoming communication a.k.a. “input” That’s why you would use expression like this
To retrieve portion of the Input string
${ Regex(input, “xxxxxxx”)[y] }
Where xxxxx is your RegEx composed based on the Table below and y is the sequential number to pick from multiple hits (starting from 0 for the first hit).
Example: Find the second 3 digit number in this string
76 8987 765 4 543 7865 435
Here is the RegEx
${ Regex(input, “\b\d{3}\b”)[1] }
Try it in the “sandbox” section located at Big6 Documentation page within HomeSeer.
NEW ! Try using artificial Intelligence to create your RegEx expressions for you.
Type in a request like “Show me RegEx that will find all words starting with “a”.
Character | Definition | Example |
^ | The pattern must appear at the beginning of a string. | ^love matches any string that begins with love Example: loveland |
$ | The pattern must appear at the end of a string. | land$ matches any string that ends with land Example: loveland |
. | Matches any character. | bear. matches bearM and bear3 but not bear32 |
[] | Matches one of any characters enclosed. | tomat[oe] matches tomato or tomate |
[^] | Matches one of any characters EXCEPT those enclosed. | 1[^02] matches 13 but not 10 or 12 |
[-] | Range. Matches any characters within the range. | [1-9] matches any single digit EXCEPT 0 |
? | Preceeding item must match one or zero times. | colou?r matches color or colourbut not colouur |
+ | Preceeding item must match one or more times. | be+ matches be or bee but not b |
* | Preceeding item must match zero or more times. | be* matches b or be or beeeeeeeeee |
() | Parentheses. Creates a substring or item that metacharacters can be applied to | a(bee)?t matches at or abeet but not abet |
{n} | Bound. Specifies exact number of times for the preceeding item to match. | [0-9]{3} matches any three digits |
{n,} | Bound. Specifies minimum number of times for the preceeding item to match. | [0-9]{3,} matches any three or more digits |
{n,m} | Bound. Specifies minimum and maximum number of times for the preceeding item to match. | [0-9]{3,5} matches any three, four, or five digits |
| | Alternation. One of the alternatives has to match. | July (first|1st|1) will match July 1st but not July 2 |
To find a match and return “true” or “false”
${ RegexMatch(input, “xxxxxxxxx”) }
Where xxxxxxxxx is the RegEx composed using the Tables above and below.
Character | Definition | Example |
\b | A word boundary, the spot between word (\w) and non-word (\W) characters | \bfred\b matches fred but not alfred or frederick |
\B | A non-word boundary | fred\B matches frederick but not fred |
\d | A single digit character | a\db matches a2b but not acb |
\D | A single non-digit character | a\Db matches aCb but not a2b |
\s | A single space character | a\sb matches a b but not ab |
\S | A single non-space character | a\Sb matches a2b but not a b |
\w | A single word character – alphanumeric and underscore | \w matches 1 or _ but not ? |
\W | A single non-word character | a\Wb matches a!b but not a2b |
Example: Proper response from Pentair Pool controller is in the format
!DD LLLL = DD where D is a digit and L is a letter
RegEx to distinguish this particular format would look like this
${ RegexMatch(input, “^!\d\d \w*\d* = \d*$”) } |
If Input = !00 AUX1 = 0 then the RegEx will produce “true” result
If Input = !!! Error No communication than RegEx will produce “false” result