Getting Regular Expression To Repeat
I'm trying to write a regex that replaces all spaces with hyphens, but only if those spaces are within an h2. I want it to repeat as many times as I need to through a document, but it only ever hits the first.
Code:
(^[<h2>]+)?((\w*)*)((\s*)*)
Replacing with
This is as close as I've been able to get it to produce so far
HTML Code:
<h2>dota dota dota dota dota</h2>
To
HTML Code:
<h2>dota-dota-dota-dota-dota-</h2>
I'm not even 100% sure why it puts that hyphen just before the last h2, but I'm much more concerned about it repeating.