Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Even assuming well-formed input (if it's not, this style of parsing may fail or, worse, incorrectly succeed) you have two problems shown by this sample input: 1) <em><em>text</em>more text</em>. 2) <em>a</em><em>b</em>. Of course, your answer is really no better than mine, but I would be hesitant to call it easily done. Regex is simply the wrong tool for this job, even when it works occasionally. Commented Jun 30, 2009 at 5:33
  • Ok. I am going to continue searching for a very "safe" and "good" method to process such "tag soup", but for now, as R. Pate's regex is working, I'm going to continue using it until i find a better solution. Thanks so much everybody!!! Commented Jun 30, 2009 at 17:10