Regex confusion, is there a tutorial?
-
Folks;
I am trying to use "http retriever" to gather data from some CAI Webcontrol boards I have scattered around the ranch monitoring Humidity,temperature, driving my smallish solar tracker, running my chicken coop lights and several other jobs. I see folks mention "it is in the documentation" in several unrelated threads but, for the life of me, I cannot find any documentation other than videos which don't work for me. :?:
I have been logging to flat files and graphing with gnuplot. I thought Mango might be a way to consolidate a pile of scripts and cron jobs but at the rate I am not getting it I probably will toss in the towel. So far I hope to get it working so others can follow along and enhance control and monitoring of their RE systems so even the uninitiated can make sense of it. Luckily it is winter and my task list is light with no outdoor work on the ranch much so I thought I would tackle Mango when it got mentioned over on Midnite Solars' forum.
Trying to migrate some of this stuff to Mango.
A typical method to grab the values is via a cgi script on the CAI boards:
wget -q -O- http://192.168.2.223/gett1.cgi|cat|awk '{ print $1'}
This gets me just the number ($1) but the cgi returns a line like this: 90.5 F . This value can be from XXX.X to -XX.x depending on the temperature
Just how do I translate these scripts to work with the http retriever? Or gather the data via a script and feed it to Mango? I have tried a bunch of things but none of it actually gets me any numeric values.
Currently the regex is "(^\d\d.\d)" but it gives nothing.
The value is always the first line and the first string in the page the cgi returns.
In particular, I have no clue what this means in the help pop up?
This is the text to parse with my value of 1234 embedded in the middle,
If the desired value is the "1234", a RegEx pattern that works may be:
my value of (.*?) embedded
Do I need to include "my value of" in the regex?
Frankly, some text based how to documents and examples would be nice but all I seem to find is videos which don't help me so much like being able to read it? I am fair with awk, sed and the like but never used regex the way Mango seems to.
A thoroughly confused newbie running out of ideas.Maybe I am trying to kill a fly with a 12 gauge shotgun using Mango for my application?
Tom
-
OK, after I posted this the bit in the help pop up made sense. Sort of. Still not sure how to implement it, however.
In my case there is nothing before the value I want and "usually" a space followed by an "F" unless it is humidity data then it is a value followed by a space and a "%".
Thanks.
Tom
edited for typos / spelling
-
Tom,
I'll ping Joel and this and get you a reply soon
Steve
-
I think I am done with this app. No obvious documentation and not user friendly / intuitive enough for me. It has potential but too steep a learning curve for my hobby level interest.
I tried. Back to crond scripts, perl,sed, awk and gnuplot, I guess.
Thanks anyway.
Tom
-
Hi Tom,
Thanks for your testing of the WebControl board. I have one in my office and have been meaning to play with it but have not had time as of yet. I know others that are using Mango without any issue to read data from them but since I haven't tested myself, at this time I can't make any suggestions. In the future we may produce a data source module specifically designed to communication and control the WebCotrol boards. Since they use their own unique API this will be the best option.
Joel.
-
I am trying to use "http retriever" to gather data from some CAI Webcontrol boards I have scattered around the ranch monitoring Humidity,temperature, driving my smallish solar tracker, running my chicken coop lights and several other jobs. I see folks mention "it is in the documentation" in several unrelated threads but, for the life of me, I cannot find any documentation other than videos which don't work for me.
-
If you are referring to regular expressions, malik, you can test them on a number of websites such as http://regexpal.com/
A comprehensive guide to regular expressions in Java can be found here: http://docs.oracle.com/javase/tutorial/essential/regex/