Skip to content

Instantly share code, notes, and snippets.

@sjoerdvisscher
Created February 23, 2010 16:10
Show Gist options
  • Save sjoerdvisscher/312344 to your computer and use it in GitHub Desktop.
Save sjoerdvisscher/312344 to your computer and use it in GitHub Desktop.
Browsers completely disagree what \s should match
<script>
var r = /\s/, a = [];
for (var i = 0; i < 0x10000; i++)
if (r.test(String.fromCharCode(i)))
a.push(i.toString(16));
document.write(a);
</script>
<p>IE: 9,a,b,c,d,20</p>
<p>FF: 9,a,b,c,d,20,a0,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,200a,200b,2028,2029,3000</p>
<p>Chrome/Safari/Opera:
9,a,b,c,d,20,a0,1680,180e,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,200a,2028,2029,202f,205f,3000</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment