<div class="name">.*?</div>
will probably work best. Using the greedy version <div class="name">.*</div>
would match multiple <div>
s as one, e.g. <div class="name">foo</div><div>bar</div>
would match as a whole.
[<div class="name">](.*)[/div]
does not work because the square braces []
denote a character class. So what the pattern does is this:
[<div class="name">] // match one of the characters `<div clas="nme>` literally
(.*) // match any character except newline, any number of times
[/div] // match one of the characters `/div` literally
P.S.: Note that <div class="name">.*?</div>
won't work with nested <div>
s.
E.g. in
<div class="name">
<div>foo</div>
</div>
it would only match
<div class="name">
<div>foo</div>
because the pattern only consumes the string up to the first occurence of </div>
.