Skip to main content

Timeline for Escaping HTML strings with jQuery

Current License: CC BY-SA 4.0

11 events
when toggle format what by license comment
Feb 9, 2023 at 16:26 comment added Travis Bemrose What if the string is already escaped? This expression matches & except when it's followed by ( 1-8 letters followed by 0-2 digits OR # followed by a 1-4 (decimal OR hex) digit number ) followed by ;. Pattern: /([<>"'`=\/]|&(?!([a-zA-Z]{1,8}\d{0,2}|#(\d{1,4}|x[a-zA-Z\d]{1,4}));))/g Use: escapeHtml('&quot;This&quot;&#9;&#x3D;&#x9;a &v3ry; &dumb; quote.') Result: '&quot;This&quot;&#9;&#x3D;&#x9;a &amp;v3ry; &dumb; quote.' In DOM: '"This"\t=\ta &amp;v3ry; &amp;dumb; quote.' Page display: "This" = a &v3ry; &dumb; quote.
Dec 11, 2022 at 14:09 comment added spy it would be handy if there were unit tests for this, but this seems like a better solution
Jan 29, 2022 at 9:03 comment added Tony Patino Sorry to bother but is there anyway this can be reversed? i don't know regex so i need help
Apr 11, 2019 at 6:47 history edited Hardik Modha CC BY-SA 4.0
Updated link.
Mar 13, 2017 at 6:51 review Suggested edits
Mar 13, 2017 at 7:33
Feb 25, 2017 at 9:01 review Suggested edits
Feb 25, 2017 at 11:14
S Jan 13, 2017 at 19:14 history suggested Marcello Mönkemeyer CC BY-SA 3.0
updated to current mustache.js (2.3.0)
Jan 13, 2017 at 16:43 review Suggested edits
S Jan 13, 2017 at 19:14
Sep 5, 2016 at 18:14 history edited Daniel X Moore CC BY-SA 3.0
Fixed indentation and updated the GitHub URL to a timeless canonical form.
Jul 11, 2014 at 6:21 review Suggested edits
Jul 11, 2014 at 6:23
Aug 20, 2012 at 8:21 history answered Tom Gruner CC BY-SA 3.0