Is the javascript regex only a
subset?
No, they are different - there are a variety of Regular Expression engines out there, and they each have different features/quirks.
C# is has more features than JavaScript, but JS's one is not derived from C# so it isn't a subset.
Here's a couple of pages that document the differences:
And that whole website (regular-expressions.info) is well worth browsing to learn more about regex.
The regex matches nested html-divs
It probably doesn't, not in all cases.
And certainly it wont be possible for a single JS regex, since it doesn't support that depth stuff, amongst other things.
You're using the wrong tool for this job - parsing HTML should be done with a proper HTML parser/selector, then analysing the DOM to find the nested divs.
Anything that implements Sizzle should do (i.e jQuery, Dojo Toolkit, and others).
For example, something like jQuery('div:has(div)')
or dojo.query('div:has(div)')
or similar, should find nested divs (i.e. select all divs which have a div nested inside them), and will correctly cope with assorted quirks which can be complex if not impossible with a single regex.
edit: I have to strip the div's, including
the text between them, away.
<div id="foo"><div>blubb</div><div foobar>blubb</div></div>some
non html...
only the "some non html..." should
stay. So I think I can't use any
htmlparser?
No - that is even more reason to use a HTML parser, and not attempt a messy regex hack.
jQuery('#foo div').remove()
That will remove all child DIVs, and leave the HTML text node in place.
Depending on your precise requirements, the selector might need changing, but this is absolutely a task for a tool that is designed to understand HTML.