I am trying to use the Regexp.h library by Nick Gammon to parse a string of text.
It comes in as V0417 R0393 G0432 B1014, using the library I was able to strip out everything I needed.
So now it comes out as 0393 0432 1014.
The only thing I cant figure out is how to add a period after the first character.
like this 0.393 0.432 1.014
In practice, all of the numbers will change but will always come in as 4 sets of 4 (I striped out the first set).
Any idea on how to just add the period after the first digit instead of replacing?
Thanks!
#include <Regexp.h>
void setup ()
{
Serial.begin (9600);
// what we are searching
char buf [100] = "V0417 R0393 G0432 B1014";
// for matching regular expressions
MatchState ms (buf);
// replace vowels
ms.GlobalReplace ("V....", "");
ms.GlobalReplace ("R", "");
ms.GlobalReplace ("G", "");
ms.GlobalReplace ("B", "");
ms.GlobalReplace ("[.-...]", ".");
Serial.println (buf);
} // end of setup
void loop () {}