REGEX help needed in HTTP Binding

Hi all,

I am new here to the community and I am on the way to setup an OpenHAB testenvironment.
Beside some other things, I want to read some data from an Arduino which is connected via Ethernet.
I can receive a string via HTTP like this:

Runtime: 07:01:05
Pin2: 0
Analog0: 4.009 V

This is just a test example, Pin22 is digital 0/1, to be extended.

I trie to read this with the following item configuration:

String HTTPstring "HTTP [%s]" (EG_Wohnzimmer) {http="<[*Analog0:.*?[0-9]+.*)]"} 


	Text item=HTTPstring label="HTTP: [%s]" 

I tried now for several hours to understand how Regex really works and tried several examples. Noting really worked.
Either ending with Nullpointer assignment Error, or just with no output.
Also the examples in the documentation did not really enlight me.

I appreciate any help on this topic,

Thanks Holger

Hi Holger,

for testing my expressions. I always use:

Your expression does a match, but it does not tell which value to use.


this will return you a 4 with the given example.
If you want to match the 4.009, use


If you need it as a number, I recommend the Java Script transformations.


Hi Renè,

thanks for your suggestion.

With the first example I get the “4” !
Sure I would like to get the complete Number, so I put the 2. string in, but this gives an error.

String HTTPstring "HTTP [%s]" (EG_Wohnzimmer) {http="<[*Analog0:.*?([0-9]+\.[0-9]+).*.)]"} 
Multiple markers at this line
- mismatched input '[' expecting RULE_STRING
- mismatched character '.' expecting set null
- mismatched input ']' expecting RULE_ID
- missing '}' at '0-9'

What is now wrong again, grr!

Found it by try’n error :wink: the \ before the dot is too much.

This works:

String HTTPstring "HTTP [%s]" (EG_Wohnzimmer) {http="<[*Analog0:.*?([0-9]+.[0-9]+).*.)]"}

The tester you posted looks nice, but he said your code was ok.
This is all very irritating for a newbie in this area.

is there any good documentation explaining the Regex coding, and what also matches to the OpenHAB implementation?

Thanks, Holger

Hi Holger,

glad you found it. Actually the backtick should mask the dot. Obviously the regex engine in Openhab does not handle this.
With your current solution, it will also match every other character after the 4.
I guess it does not matter.



I am fighting with ghosts…
Using the HTTP binding on SmartDen32i, the .items file provided by them:

String CurrentState "" {

Got this on logs:
2018-12-30 23:42:52.971 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type REGEX
2018-12-30 23:42:52.974 [WARN ] [ab.binding.http.internal.HttpBinding] - Couldn’t transform response because transformationService of type ‘REGEX’ is unavailable

Is it any lib needed? I am missing something?..

Help would be super…


maybe someone can help me out. I’m trying to retrieve the hours of sun for the next days. I tested the regex with Regex101 and it works ok, but I can’t get it in home.items. For now I only need to get a string displayed in any form like “|2|10.1|6.6|5.4|2.6|2.6|6.2|” (or any form) to know the link is working.

Regex101 tester:


 String vSonne "Test Sun [%s]" <sun-clouds> 
    { http="<[*?>\\s*(\\d*\\.?\\d+))]" }


    Text item=vSonne

in http.cfg it does not make any difference, I suppose because I embedded the link in the items.

# sonne.url=


I used as well many different updateIntervals…

No errors at openhab.log.

Thanks for any help.