Created
January 15, 2019 18:40
-
-
Save qwIvan/8ec83a3b0dc4f599b77eef4585d85451 to your computer and use it in GitHub Desktop.
Revisions
-
qwIvan created this gist
Jan 15, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ // https://regex101.com/r/yX5xS8/73 const html = ` <ImG sTyle="" src="http://t.cn/EqRt9Eh" class=">" Style="" /> <ImG style="" src="http://t.cn/EqRt9Eh" class=">" STYLE="" > `.replace(/<((?:"[^"]*"['"]*|'[^']*'['"]*|[^'">\/])+)\/?>/gi, '<img style="max-width: 100%" $1 style="max-width: 100%" >'); console.log(html)