I’m having problems getting REGEX to work with the HTTP Binding, i want to gather some information from my iFit profile which is publically available. When i don’t do any REGEX to the channel “elevation” i get full HTML code so i know its working.
I plugged my REGEX expression into https://regex101.com/ and it works so i’m at a loss. I read a bunch of threads and had no luck…
The OH3 HTTP Binding documentation states two colons and i tried both ways “REGEX:” and “REGEX::”
Here is what i have:
Thing:
Thing http:url:iFit_Alexa "Alexa iFit Elevation" [
baseURL="https://www.ifit.com/profile/5febe06f7b394904ca3d07be/following",
headers="key1=value1", "key2=value2", "key3=value3",
stateMethod="GET",
refresh=10 ] {
Channels:
Type string : elevation "Elevation" [ stateTransformation="REGEX:<span>(.*?) ft<" ]
}
Item:
String iFit_Alexa_Elevation "Alexa Elevation [%s]" { channel="http:url:iFit_Alexa:elevation"}
The section of HTML i’m trying to capture is the Elevation of “2,213” in the HTML snip below:
>Monthly Stats</h2><ul class="stats"><li class="stat-item stat-item--elevation">Elevation<span>2,213 ft</span></li>
Does anyone see what i’m doing wrong?