in reply to pattern match
Given the incredibly vague problem statement I'll just toss out that this looks awfully like you're trying to parse some variant of XML in which case unless you have a very restricted input that you can guarantee follows a very static format trying to use regexen to parse it is probably going to cause more headaches than it's worth. Use a proper parser (e.g. XML::Twig, XML::Simple) and save yourself the trouble.
Update: And see XML::Twig and Processing Instructions for getting, erm, XML::Twig to handle processing instructions.
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|