Menu
Hello, I’ve been having trouble with RegExp in JavaScript.
I have a string in one of my scripts that is similar to this:
[CODE]var str = ‘
<div class=”main” id=”content”></div>
<div class=”sub” name=”subcontent”></div>’;
How do I return an array of the values “main” and “sub”, or anything else in the class tags?
I came up with something like this, but it fails to return the values I’m looking for.
[CODE]alert(str.match(/(?=class=”)w+(?=”)/gi));