Created
January 15, 2019 19:20
-
-
Save qwIvan/c23e1e84aed8b365ab13dfa054df106b 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/74 const html = ` <ImG sTyle="" src="http://t.cn/EqRt9Eh" class=">" Style="" /> <ImG style="" src="http://t.cn/EqRt9Eh" class=">" STYLE="" > `.replace(/<img((?:"[^"]*"['"]*|'[^']*'['"]*|[^'">\/])+)\/?>/gi, '<img style="max-width: 100%" $1 style="max-width: 100%" >'); console.log(html)