Created
June 26, 2011 00:52
-
-
Save hal-gh/1047103 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data='<th scope="col" style="padding-top:0">Heading one</th> </tr><tr class="odd"> <td>May 2011</td> <td>dfgibwsd</td> '; | |
var regExArr = [ | |
{ | |
"regex":"<td.*>[\\S\\s]*</td>", | |
"modifier":"gi", | |
"action":"match" | |
} | |
] | |
var resultsArray = []; | |
for(var i=0,ilen=regExArr.length;i<ilen;i++){ | |
console.log("regExArr[i].action: " +regExArr[i].action); | |
console.log("regExArr[i].regex: " +regExArr[i].regex); | |
var thisRegex = new RegExp(regExArr[i].regex,regExArr[i].modifier) | |
if(regExArr[i].action === "match"){ | |
resultsArray = data.match(thisRegex); | |
} | |
} | |
console.log("resultsArray.length: " +resultsArray.length); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment