http-Binding & REGEX Transformation Problem

I am in despair. I have a 4-way switch (NETIO-230) that can only be integrated with the HTTP binding.
In principle, this also works. I can operate every switch, but I don’t get any for the individual switch
separate feedback, since the status for all 4 switches is given as a string in the form 0 0 1 1.
(0=ON, 1=OFF).

Through an XPath stateTransformation I can isolate the state in the form “0 0 1 1” and use as a string in a
rules. But that’s a little cumbersome.

I want a REGEX transform for each switch state. Through the expression (0-1) I get
(Test on https://regex101.com/) e.g. the status of the 3rd switch (from the left) from 1 0 1 1 as
String 0 or 1 isolated but get no result when I use this expression in channel or item settings
from OH3 V3.2.0 use.

The transform is installed. For example, with the expression (.*) I get the complete status string 0 0 1 1 displayed.

Who is specialist in REGEX with http binding and can help me.

It would be ideal if I had an ON/OFF value for each switch to use in the switch channels. The isolation as string 0/1 would be a first step for further processing with MAP transformation.

My http-Thing Definition

Thing  http:url:netio230 "_NETIO-230"  [
    baseURL="http://192.168.31.3/tgi/control.tgi?login=p:user:xxx", 
    authMode = "BASIC", 
    commandMethod = "GET",
    ignoreSSLErrors = true, 
    bufferSize = "2048", 
    timeout = "3000", 
    refresh=10 ] 
	{
    Channels:
	   Type switch : netio0 "Schalter1" [
            commandExtension = "&port=%2$s",
            stateExtension = "&port=list",            
            onValue= "1uuu", offValue = "0uuu",
            mode="WRITEONLY"
        ]
        Type switch : netio1 "Schalter2" [
            commandExtension ="&port=%2$s",
            stateExtension = "&port=list",            
            onValue= "u1uu", offValue = "u0uu",
            mode="WRITEONLY"
        ]
        Type switch : netio2 "Schalter3" [
            commandExtension = "&port=%2$s",
            stateExtension = "&port=list",
            onValue= "uu1u", offValue = "uu0u",
            mode="WRITEONLY"
        ]         
        Type switch : netio3 "Schalter4" [
            commandExtension = "&port=%2$s",
            stateExtension = "&port=list",           
            onValue= "uuu1", offValue = "uuu0",
            mode="WRITEONLY"
        ]  
        Type string : netiostat "NETIO-Status" [
            stateExtension = "&port=list",
            stateTransformation = "XPath:/html/text()",       
            mode="READONLY"
        ]     
	}

REGEX in openHAB works slightly differently from normal.

  1. The expression must match the entire string
  2. The first matching group is what gets returned

So to get the first value

([0,1]).*

To get the second

[0,1] ([0,1]).*

To get the third

[0,1] [0,1] ([0.1]).*

To get the last

.*([0,1])

These assume that there is no extra white space before or after the string. These also assume that you are indeed only processing exactly that string and nothing else (see 1).

Correction, the status for all 4 switches without any transformation is in the form

<html>1 0 1 1</html>

Oh great - thanks - it works for e.g. the 3rd switch with:

REGEX:<html>[0,1] [0,1] ([0.1]).*

It works, thanks to Rich Koshak’s suggestion. Here is the complete solution for everyone who also wants to integrate an (older) NETIO-230 socket strip.

/*
http://192.168.xxx.xxx/tgi/control.tgi?login=p:username:password             // nur anmelden
http://192.168.xxx.xxx/tgi/control.tgi?login=p:username:password&port=list   // Portzustand auslesen als <html>X X X X</html>
http://192.168.xxx.xxx/tgi/control.tgi?login=p:username:password&port=uuuu   // Port 0-3 setzen 0/1/unverändert
http://192.168.xxx.xxx/tgi/control.tgi?quit=quit                             // Abmelden
*/

Thing  http:url:netio230 "_NETIO-230"  [
    baseURL="http://192.168.xxx.xxx/tgi/control.tgi?login=p:username:password", 
    authMode = "BASIC", 
    commandMethod = "GET",
    ignoreSSLErrors = true, 
    bufferSize = "2048", 
    timeout = "3000", 
    refresh=10 ] 
    {
    Channels:
	Type switch : netio0 "Schalter1" [
            commandExtension = "&port=%2$suuu",
            onValue= "1", offValue = "0",            
            stateExtension = "&port=list", 
            stateTransformation = "REGEX:<html>([0.1]).*",                       
            mode="READWRITE" 
        ]
        Type switch : netio1 "Schalter2" [
            commandExtension ="&port=u%2$suu",
            onValue= "1", offValue = "0",            
            stateExtension = "&port=list",
            stateTransformation = "REGEX:<html>[0,1] ([0.1]).*",                       
            mode="READWRITE" 
        ]
        Type switch : netio2 "Schalter3" [
            commandExtension = "&port=uu%2$su",
            onValue= "1", offValue = "0",
            stateExtension = "&port=list",
            stateTransformation = "REGEX:<html>[0,1] [0,1] ([0.1]).*",
            mode="READWRITE"           
        ]         
        Type switch : netio3 "Schalter4" [
            commandExtension = "&port=uuu%2$s",
            onValue= "1", offValue = "0",            
            stateExtension = "&port=list", 
            stateTransformation = "REGEX:.*([0,1]).*",                      
            mode="READWRITE" 
        ]
        // nur zur Kontrolle 
        Type string : netiostat "NETIO-Status" [
            stateExtension = "&port=list",
            stateTransformation = "XPath:/html/text()",       
            mode="READONLY"
        ]               
    }