Unescape with broken regexp (#2992)

This commit is contained in:
Michał Lipiński
2017-02-09 20:26:58 +01:00
committed by John-David Dalton
parent 477fdb2cf2
commit 39931f9eaa

View File

@@ -10,12 +10,12 @@ const htmlUnescapes = {
}
/** Used to match HTML entities and HTML characters. */
const reEscapedHtml = /&(?:amp|lt|gt|quot|#39)g
const reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g
const reHasEscapedHtml = RegExp(reEscapedHtml.source)
/**
* The inverse of `escape`this method converts the HTML entities
* `&amp, `&lt` `&gt`,`&quot`, nd `&#39` in`string` to
* `&`, `<`, `>`, `"` and `'` in `string` to
* their corresponding characters.
*
* **Note:** No other HTML entities are unescaped. To unescape additional
@@ -28,7 +28,7 @@ const reHasEscapedHtml = RegExp(reEscapedHtml.source)
* @see escape, escapeRegExp
* @example
*
* unescape('fred, barney, &amppebbles')
* unescape('fred, barney, & pebbles')
* // => 'fred, barney, & pebbles'
*/
function unescape(string) {