Well said.
Unfortunately I cannot provide an actual example.
So here goes:
- I have no control over the incoming data. It will effectively be pasted by someone in a <TEXTAREA>.
- The data lines may contain sporadic empty lines, which are to be ignored.
- There are useless lines and characters before the useful data starts.
- There are useless lines and characters after the useful data ends.
- The first unique point at which a line can be identified as being useful, is that it start with the characters 'Number:'.
This identifier (index) is not at the start of the data.
- The data can be split into 4 sections:
TOP
A set of values with no keys. These are always in the same place relative to each other.
So, in my previous example, you could safely say $result{Name}='Graq';.
There is only one value per line.
- MIDDLE
A set of key-value pairs seperated by a colon and space /: /.
Some lines have 2 key-value pairs on them (never more).
Keys may contain spaces, values may not.
- BOTTOM
- A set of key-value pairs seperated by a colon and space.
One key-value pair per line (see below).
- A set of values. These values correspond to key-value pair in (i).
One value per line (see below).
NB: The first line of (ii) will be on the same line as the last line of (i), seperated by a space.
- END
A single key-value pair (colon and space seperated), where the value may be missing.
Note on lines with multiple key-value pairs:
- The TOP and MIDDLE never mix.
- MIDDLE values may have multiple entries.
- MIDDLE and BOTTOM(i) may overlap.
- BOTTOM(i) and BOTTOM(ii) always overlap.
- BOTTOM(ii) and END never mix.
Please don't ask why this is :(
<a href="http://www.graq.co.uk">Graq</a>
edited by footpad, ~Tue Dec 4 14:42:09 2001 (GMT)