Skip to content

Instantly share code, notes, and snippets.

@id4ehsan
Created April 4, 2018 17:57
Show Gist options
  • Save id4ehsan/d4655d891b263ad0a77c819f094fb9b6 to your computer and use it in GitHub Desktop.
Save id4ehsan/d4655d891b263ad0a77c819f094fb9b6 to your computer and use it in GitHub Desktop.
my regex
Remove all PHP Code within the HTML page
<\?php(.+?)\?> ==> <!--/1-->
Change b to strong
<b[^>]*>([^<]*?)</b> ==> <strong>\1</strong>
Change i to em
<i[^>]*>([^<]*?)</i>
<em>\1</em>
Make Icone via ImageMagick for web
"C:\Program Files\ImageMagick-7.0.7-Q16\convert.exe" favicon.png -bordercolor white -border 0 -clone 0 -resize 16x16 -clone 0 -resize 32x32 -clone 0 -resize 48x48 -clone 0 -resize 64x64 -delete 0 -alpha off -colors 256 favicon.ico
Remove Tables
<table.*?>.*?</table>
Tables and Rows
<table.*?>.*?<(tr).*?>[^<.]*?</tr>.*?</table>
a bettet version to remove table
<(table|thead|tbody|tr|th|td).*?>[^<.]*?</\1>
<(table|thead|tbody|tr|th|td)([^>]*?)>([^<]+?\b)</\1>
<(table|thead|tbody|tr|th|td)([^>]*?)>(?:(?!\1).)*?</\1>
<(table|thead|tbody|tr|th|td)([^>]*?)>((?:(?!\1)[^<])*?)</\1>
<div\2>\3</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment