Problem with special characters in http binding and regex

I’m trying to fetch some pollen data from an swedish site…

My plan is to fetch an html-table from the site to a “raw” string in openhab. Then use a rule and a update trigger transform the table into an HTML page, store it in /etc/openhab2/html directory. Finaly I include it in my sitemap.

Perhaps there is a better way to do it… ??

Anyhow;
I think I have got my regex to filter out the table correct (I have tried it on regex101.com and it seems to do the trick).
But it contains " and I don’t manage to put it in my REGEX in the http clause I have tried to esc it… The REGEX looks like this (?s)<table class="pollen-table">.*<\/table>.

Next problem is that I need to get it from an swidish site with an ö in the address… https://www.klart.se/se/pollenprognoser/stationer/malmö/ which is a stupid address but the site is one of the best in sweden to get the info…

My Item looks like this for the moment, but I have a problem both with the ö and "

String Weather_Pollen   "Pollen_RAW"       { http="<[https://www.klart.se/se/pollenprognoser/stationer/malmö/:3600000:REGEX((?s)<table class=\"pollen-table\">.*<\/table>)]" }

Any suggestions?

The REGEX transformation requires the REGEX to match the entire HTML Page and it returns the first matching Group. Assuming you actually want the table to be returned your expression needs to be something like

.*(<table class="pollen-table">.*</table>).*

I can’t help with the ö

Thanks for the quick response!
I think it’s the ö that are casuing the problem

String  Weather_Pollen   "Pollen_RAW"       { http="<[https://www.klart.se/se/pollenprognoser/stationer/malmö/:3600000:REGEX(.*(<table class=\"pollen-table\">.*</table>).*)]" }

results in this error in my openhab.log

java.lang.IllegalArgumentException: Invalid uri 'https://www.klart.se/se/pollenprognoser/stationer/malm?/': escaped absolute path not valid
        at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222) ~[195:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7]
        at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89) ~[195:org.apache.servicemix.bundles.commons-httpclient:3.1.0.7]
        at org.openhab.io.net.http.HttpUtil.createHttpMethod(HttpUtil.java:314) ~[196:org.openhab.core.compat1x:2.4.0]
        at org.openhab.io.net.http.HttpUtil.executeUrl(HttpUtil.java:167) ~[196:org.openhab.core.compat1x:2.4.0]
        at org.openhab.io.net.http.HttpUtil.executeUrl(HttpUtil.java:130) ~[196:org.openhab.core.compat1x:2.4.0]
        at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:172) ~[?:?]
        at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) ~[196:org.openhab.core.compat1x:2.4.0]
        at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [196:org.openhab.core.compat1x:2.4.0]

As you can see it says malm? insted of malmö… Maybe it could be some sort of encoding problem…?

I have also tried with and html encoded ö

String  Weather_Pollen   "Pollen_RAW"       { http="<[https://www.klart.se/se/pollenprognoser/stationer/malm%C3%B6/:3600000:REGEX(.*(<table class=\"pollen-table\">.*</table>).*)]" }

But that gives also an error

[ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread HTTP Refresh Service
java.util.IllegalFormatConversionException: c != java.util.Date
        at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:4302) ~[?:?]
        at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869) ~[?:?]
        at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757) ~[?:?]
        at java.util.Formatter.format(Formatter.java:2520) ~[?:?]
        at java.util.Formatter.format(Formatter.java:2455) ~[?:?]
        at java.lang.String.format(String.java:2940) ~[?:?]
        at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:144) ~[?:?]
        at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) ~[196:org.openhab.core.compat1x:2.4.0]
        at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [196:org.openhab.core.compat1x: