Thanks for the offer. I have temporarily abandoned the regex approach and have just done the initial cmd recognition by looking for the 4 possible commands. All I have thus far is a working prog. that does the serial input and recognizes the commands but does not yet process any of them.
I still have a great desire to use regex to handle the parsing (via the captures) of the operands portion of the commands.
To be more precise, a command such as "ATW 4,5 :1,2,55,ef" means to write blocks 4 and 5 with data bytes '1' '2' 0x55 0xef and the remaining parts of the blocks would be filled with the Fill_Byte.
The part I'm struggling with is the operand i.e. this string ":1,2,55,ef".
A 1 character data byte is understood to be a 'keyboard character' while a 2 character data byte pair is understood to be expressed in HEX. I just don't require the "0x" to preceed the 2 characters.
Tomorrow, I'll post a complete sketch of a simple approach (simple as I think I understand it) to using regex to 'parse' the operand portion of a command.
I'm going to try to provide an example of every possible valid operand string regardless of which command it goes with.
Just a a little preview, here are some commands with their operands:
ATH {NO OPERANDS}
ATS {NO OPERANDS - BOTH are opt.}
ATS CLASSIC|ULTRALIGHT :1 {Both operands are opt.}
ATS :ef {1st operand omitted, 2nd operand 1 bye HEX}
ATS classic :00 {BOTH operands provided}
ATR {BOTH operands omitted - BOTH opt.}
ATR 4,5 {BOTH operands provided}
ATR ,5 {INVALID}
ATR 5 {2nd operand omitted}
ATW {Very similar to the "ATR" cmd.}
If I could develop some regex's to handle the operands, it would be useful here and be a good learning experience.
Tomorrow's sketch will only deal with the strings that represent the command operands -- no additional stuff.
Ray