-6

Possible Duplicate:
RegEx match open tags except XHTML self-contained tags

how can I replace everything in between < > and the tag itself with a space?

Example:

<span class="bold">asdfsdfsda<br />sadfsdfsdf</span>

Output:

 asdfsdfsda sadfsdfsdf 
Community
  • 1
  • 1
Sam
  • 123
  • 1
  • 9
  • 5
    [The pony he comes...](http://stackoverflow.com/a/1732454/554546) –  Jun 03 '12 at 04:03

1 Answers1

1

DON'T PARSE HTML with regex. If this in a onetime controlled situation, then this would do:

Here it is in ruby. Change it based upon your tool.

myline = '<span class="bold">asdfsdfsda<br />sadfsdfsdf</span>'
myline.gsub(/<[^<]*>/," ")
Anil
  • 3,899
  • 1
  • 20
  • 28