in reply to Regular expression question strikes again
have you ever considered Parse::RecDescent? you can use regexp for matching, and it's grammar for your logic.
Oha