4 Answers
4

First, parsing HTML with regex is baaad... seriously man, you can use the innerHTML property of each div to change it's content, or better, use jQuery or another javascript framework to do this kind of jobs.

This job can be made with jquery in this way:

$("div.a").each(
function() {
alert($(this).html())
}
);

Second, if you want badly to use regex, and assuming there is only text (no markup) between the divs, you can use something like this: