I defined 2 RegEx expressions and one is not working:
I have a webpage that I like to extract two pieces of data of.
One of the (RegEx) extractions works, the other renders nothing and I cant figure out why.
I setup my http service with the proper ip like so:
motionCam.url=http://192.168.1.106:8080/0/detection/connection
motionCam.updateInterval=600
That page renders the following text:
<– back
<b>Camera 0 -- Beneden</b> Connection OK
I want to extract the number ‘0’ as well as the word ‘Beneden’
I do that as follows:
Number VT_Camera_number "Camera number [%d]" <camera> (Security) { http="<[motionCam:600:REGEX(.*Camera\\s(\\d).*)]" }
String VT_Camera_name "Camera name [%s]" <camera> (Security) { http="<motionCam:600:RegEx(.*Camera\\s\\d\\s--\\s(.*)<\\/b>\\sC.*)]" }
oddly though I have NO problem extracting the number, but I cannot extract the name, the string remains empty and I cant figure out why.
What the defined REGEX does is it looks for the word “Camera” followed by a space, followed by a digit, followed by a space, followed by two hypens, followed by a space, followed by any piece of text (That should be the word"Beneden"), followed by the html code for end-bold, followed by a space and a capital C
I tested the RegEx, and that should be OK (see fig), but ofcourse for OpenHab I had to escape the escape characters, hence the ‘\\’
Any ideas about what I am doing wrong are appreciated
Edit
This, dear readers was where the fault was, not in the REGEX itself. nevertheless, this thread contains some useful info on how to track mistakes in REGEX