I'm in the process of putting together a questionaire/survey. I need the ability to have dynamic questions based on previous answers. Let's say question 1 is "How old are you?" Question 2 would then be something like "As a [answer]1[/answer] year old, what is your favorite color?" What I need to do is parse the question, see if it is dynamic (by detecting the [answer][/answer] tags), and then pull out what is in between the tags (in the example it would be the "1" representative of the answer to question 1), and then replace it in the question itself. What would be the best and cleanest method for doing this? Should I first check to see if the [answer] tag exists using ereg? Then how would I pull out what's between the tags and replace it all? Is there a cleaner more efficient way? Thanks in advance for any and all suggestions.