How to search for class names in a html file using regex? -


i wondering myself if want classes names in html file, regex can use? don't understand way can mount it. have code:

html

<html>     <div class="myfirstclass"></div>     <div class="mysecondclass2"></div> </html> 

i want know how get:

myfirstclass mysendclass2 

using regex... tried use class=".*" gets ever outside of name.

use map function

var classes= $("div").map(function() {     return this; }).get(); for(i=0;i<classes.length;i++){     console.log($(classes[i]).attr('class')); } 

jsfiddle link of working code

http://jsfiddle.net/mkamithkumar/dlkky/


Comments