Trouble with REGEX Transformation

Hi Community,

i am having some trouble integrating my PiAware into Openhab.

I have two websites from which I want to display figures to my openhab sitemap.

Website 1: Local raspberry pi website with information about planes / messages etc.
Website 2: My public Flightaware userwebsite with statics.

I will be concentrating about the public site for everyone to :

As an example, I want to display my current rank on my sitemap.

The HTML code is as follows:

<li>
<span class="memberDetailsLabel">Highest User Ranking Achieved in Last 30 Days: </span>
<span class="memberDetailsValue">16,418</span></li>
</li>

Two of my items are:

String      Planes          "Planes [%s]"  (Test)    {http="<[http://192.168.0.111/dump1090-fa:15000:REGEX((.*id=)(.)(dump1090_total_ac)(.)(>).*(<)(.)(span>))]"} 
String      Rank            "Rank [%s]"    (Test)    {http="<[https://flightaware.com/adsb/stats/user/Murphy1982#stats-136202:15000:REGEX((.*class=)(.)(memberDetailsValue)(.)(>).*(<)(.)(span>))]"} 

Some how i do not get any of the items to show any value properly.

Does anyone know what i am doing wrong?

Thanks

Olaf

In openHAB REGEX works a little differently from normal. The expression must match the entire String/document and the first matching group is what gets returned. So your second Item’s expression would need to be something like

.*class=\"memberDetailsValue\">(.*)</span>.*

Hi Rich

Thanks for the quick reply.

I am not getting the complete website. If i am not mistaken REGEX should look up only the line in question. Or am I wrong here?

Like I said. REGEX works differently in OH. You have to match the entire string passed to the transform and only the first matching group gets returned.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.