Created
January 24, 2012 20:08
-
-
Save chjj/1672262 to your computer and use it in GitHub Desktop.
regex failure
This file contains 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
var regex = /^ *<\w+(?!:\/|@)\b(?:"[^"]*"|'[^']*'|[^>])*?> *(?:\n{2,}|\s*$)/; | |
var str = '' | |
+ '<div class="hero-unit">\n' | |
+ ' <img src="img/hello_world.png" style="misc: properties;">\n' | |
+ ' <div>\n' | |
+ ' <h1>hello world</h1>\n' | |
+ ' <p>hello world.</p>\n' | |
+ ' <p><a class="hello world" href="#!hello">hello world</a></p>\n' | |
+ ' </div>\n' | |
+ '</div>\n' | |
+ ' <!-- comment -->\n' | |
+ '<section id="an_id">\n' | |
+ ' <div class="a_class">\n' | |
+ ' <h1>hello <small>world</small></h1>\n' | |
+ ' </div>\n' | |
+ ' <div class="row">\n' | |
+ ' <div class="hello world">\n' | |
+ ' <div class="hello">\n' | |
+ ' <img align="middle" src="image/image.png" style="css: properties;">\n' | |
+ ' <p align="middle"><span class="hello wolrd">hello</span></p>\n' | |
+ ' <p align="middle"><a class="hello world" href="#!hello">hello world</a></p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h2>hello world</h2>\n' | |
+ ' <p>hello world</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello world">\n' | |
+ ' <div class="hello">\n' | |
+ ' <img align="middle" src="img/image.png" style="css: properties;">\n' | |
+ ' <p align="middle"><span class="hello world">hello world</span></p>\n' | |
+ ' <p align="middle"><a class="hello world" href="#!hello">hello world</a></p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h2>hello wolrd</h2>\n' | |
+ ' <p>hello world</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' <hr>\n' | |
+ ' <div class="hello">\n' | |
+ ' <div class="hello world">\n' | |
+ ' <div class="hello">\n' | |
+ ' <img src="img/image.png" align="middle" style="css: properties;">\n' | |
+ ' <p align="middle"><span class="hello world"><a style="css: properties;" href="/url_here">hello world</a></span></p>\n' | |
+ ' <p align="middle"><a class="hello world" href="#!hello">hello world</a></p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h2>hello world</h2>\n' | |
+ ' <p>hello world</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello world">\n' | |
+ ' <div class="hello">\n' | |
+ ' <img align="middle" src="image/image.png" style="css: properties;">\n' | |
+ ' <p align="middle"><span class="hello">hello</span></p>\n' | |
+ ' <p align="middle"><a class="hello world" href="/url_here">hello world</a></p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h2>hello world</h2>\n' | |
+ ' <p>hello world</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello world">\n' | |
+ ' <div class="hello">\n' | |
+ ' <img align="middle" src="image/image.png" style="css: properties;">\n' | |
+ ' <p align="middle"><span class="hello world">hello</span></p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h2>hello world</h2>\n' | |
+ ' <p>hello world</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ '</section>\n' | |
+ '\n' | |
+ '<section id="hello">\n' | |
+ '<div class="hello">\n' | |
+ '<h1>hello <small>world</small></h1>\n' | |
+ '</div>\n' | |
+ '<div class="hello">\n' | |
+ '<div class="hello world">\n' | |
+ ' <div class="hello">\n' | |
+ ' <img align="middle" src="image/image.png" style="css: properties;">\n' | |
+ ' <p align="middle"><span class="hello world">hello world</span></p>\n' | |
+ ' <p align="middle"><a class="hello world" href="/url_here">hello world</a></p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h2>hello</h2>\n' | |
+ ' <p>hello world</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello world">\n' | |
+ ' <div class="hello">\n' | |
+ ' <img align="middle" src="/url_here" style="css: properties;">\n' | |
+ ' <p align="middle"><span class="hello">hello</span></p>\n' | |
+ ' <p align="middle"><a class="hello world" href="/url_here">hello world</a></p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h2>hello world</h2>\n' | |
+ ' <p>hello world</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello world">\n' | |
+ ' <div class="hello">\n' | |
+ ' <img align="middle" src="image/image.png" style="css: props;">\n' | |
+ ' <p align="middle"><span class="hello world">hello world</span></p>\n' | |
+ ' <p align="middle"><a class="hello world" href="/url_here">hello world</a></p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h2>hello</h2>\n' | |
+ ' <p>hello world</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ '</section>\n' | |
+ '\n' | |
+ '<section id="hello">\n' | |
+ ' <div class="hello">\n' | |
+ ' <h1>hello <small>world</small></h1>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <div class="hello">\n' | |
+ ' <h3>hello world</h3>\n' | |
+ ' <a title="hello world" href="/url_here" class="hello world">hello</a>\n' | |
+ ' <p class="hello">hello world</p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h3>hello</h3>\n' | |
+ ' <a title="hello world" href="/url_here" class="hello world">hello</a>\n' | |
+ ' <p class="hello">hello world <a href="/url_here">hello</a>.</p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h3>hello world</h3>\n' | |
+ ' <a title="hello world" href="/url_here" class="hello world">hello</a>\n' | |
+ ' <p class="hello">hello world</p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h3>hello</h3>\n' | |
+ ' <a title="hello world" href="/url_here" class="hello world">hello</a>\n' | |
+ ' <p class="hello">hello world</p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h3>hello</h3>\n' | |
+ ' <a title="hello world" href="/url_here" class="hello_world">hello</a>\n' | |
+ ' <p class="hello">hello world.</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <div class="hello">\n' | |
+ ' <h3>hello</h3>\n' | |
+ ' <a title="hello world" href="/url_here" class="hello world">hello</a>\n' | |
+ ' <p class="hello">hello world</p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h3>hello world</h3>\n' | |
+ ' <a title="hello world" href="/url_here" class="hello world">hello</a>\n' | |
+ ' <p class="hello">hello world</p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h3>hello</h3>\n' | |
+ ' <a title="hello world" href="/url_here" class="hello world">hello</a>\n' | |
+ ' <p class="hello">hello <a href="/url_here">hello</a> world</p>\n' | |
+ ' </div>\n' | |
+ ' <div class="hello">\n' | |
+ ' <h3>hello</h3>\n' | |
+ ' <a title="hello world" href="/url_here" class="hello world">hello</a>\n' | |
+ ' <p class="hello">\n' | |
+ ' hello world.</p>\n' | |
+ ' </div>\n' | |
+ ' </div>\n' | |
+ '</section>\n'; | |
var out = regex.exec(str); // v8 dies here | |
console.log(out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment