johnnywang has asked for the wisdom of the Perl Monks concerning the following question:
here the PAIRS value 4 indicates how many pairs are there afterwards (e.g., 4: A, B, C, D). I need to be able to handle the following situations: (1)commands may come in succession contineously, or very sparsely; (2) commands need to be processed right away if it is complete, so can't wait for the start of the next command; (3)there might not be a separator at the end of the command, even not a space; (4) command may be corrupted, so "START" can appear before the last one is done, in which case, ignore the last oneSTART NAME FOO PAIRS 4 A 3 B 5 C 1.2 D some_binary_data_with_first_byt +e_indicating_length
I'm thinking I may need to implement a DFA myself, but that's already part of the built-in regex engine, so is there an easy way?
greatly appreciated, thanks in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex for a socket stream
by BrowserUk (Patriarch) on Jul 17, 2004 at 00:25 UTC | |
|
Re: regex for a socket stream
by zentara (Cardinal) on Jul 16, 2004 at 19:32 UTC | |
by johnnywang (Priest) on Jul 16, 2004 at 19:43 UTC | |
|
Re: regex for a socket stream
by saintmike (Vicar) on Jul 16, 2004 at 19:57 UTC | |
|
Re: regex for a socket stream
by blokhead (Monsignor) on Jul 16, 2004 at 20:09 UTC |