views:

39

answers:

1

I am trying to remove some <span style="something not constant"> from a text and I tried M-x replace-regexp> "<span*>" -> ""

but it does nothing. I made sure the cursor is at the beginning of the file.

+2  A: 

You must probably know that * in a regex means 'repetition', and i'm not sure you want to remove something like <spannnnn>, do you ?

What you mean is probably: <span.*>

PS: Made the same mistake as you ;)

Antoine Pelisse
oh im terribly sorry, fixed it
fakedrake
Thanx that worked!! but it still doesnt find the first ">", it rather finds tha one at the end of line... eg: `<span syle="jhdkljhf"><p><\p>` i removes thw whole line
fakedrake
That's because the regex is greedy, you might want to use .*?
Antoine Pelisse
A nicer way would be `<span[^>]*>`
Antoine Pelisse
well thank you very much!! that worked!
fakedrake