Skip to content

Instantly share code, notes, and snippets.

@fwextensions
Created March 6, 2011 02:25
Show Gist options
  • Save fwextensions/856966 to your computer and use it in GitHub Desktop.
Save fwextensions/856966 to your computer and use it in GitHub Desktop.
/*
The regular expression below is used in John Resig's HTML parser written in JS, which
I was trying to use in an Adobe Fireworks extension to construct tables from HTML
source. In a browser, from IE6 on up, it produces:
[<table border="1">,table, border="1",""]
In Fireworks' JS parser, derived from Mozilla code released in *1998*, it produces:
null
Thanks, Adobe!
*/
alert('<table border="1">'.match(/^<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment