Replace HTML using php -
i'm trying match section shown below , delete html file, have not been successful using regex , have little knowledge on how match section using php parser , replace it.
<table width='100%' class='print_only_wrapper'> <thead class='print_only_header'> <tr> <td align='right' class='print_only_wrapper'> text </td> </tr> </thead> <tbody> <tr> <td>
this have tried search string , replace it
if(preg_match("/<thead/", $html)) { $string_2_replace="/(<table width='100%' class='print_only_wrapper'>)\s+(<thead class='print_only_header'><tr><td align='right' class='print_only_wrapper'>).+(</td></tr></thead>)\s+(<tbody><tr><td>)/"; $html = str_replace($string_2_replace, "", $html); }
its easy,
\w
- matches alphabets special chars
\w
- non alphabets without special chars
so try this
<table[^>]*?>[\w\w]*?<\/td>$
try on $string_2_replace
.
then reply me...
Comments
Post a Comment