I'm developing a system (in PHP) that will take in a string of text (from email, initially) and need to determine the beginning and end of a section of the text that contains name=value pairs of data, and parse that section so that the name=value pairs can be processed into a form submission. I am looking for ideas on what to use as delimiters, what algorithm to use for the processing (push the whole thing through a regular expression? process it line by line?), functions to use for parsing, etc.
I will also need to somehow validate the data before processing it, allow for multiple field names to be used for the same fields (coming from different systems) and allow for optional fields. Are there other things I should be concerned about as well?
As an example, I might receive an email like this:
--
Dear Brain,
Please open this ticket.
System: Windows Issue
Severity: Complete Work Stoppage
Short Description: Narf!
Long Description: I don't know what the h$#* happened!
Oh, and yeah, can you do it tonight?
Pinky
--
We currently have a web-based form where users can manually open a ticket. I want to link into that system and submit an HTML form to the same process. I'm not looking for a programming solution, just some "best practice" ideas.
Thanks!