Re: use preg_replace to nix and line with "display: none"
| From: | Rob Gould | Date: | Sun, 09 Aug 2009 06:17:56 +0000 |
| Subject: | Re: use preg_replace to nix and line with "display: none" | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-296499@lists.php.net to get a copy of this message | ||
I wish I could say this works, but I'm not having success with this pattern. All the lines with display: none are still in the $bl string.
On Aug 9, 2009, at 1:50 AM, LinuxManMikeC wrote:
<li id="bullet_ug1_col2_9" style="display: list-item;">Reserved Frontstretch Tower Ticket to the Camping World 300 on Saturday </li> <li id="bullet_2_9" style="display: list-item;">Reserved Frontstretch Tower Ticket to the Daytona 500 on Sunday </li> <li id="bullet_addon_col2_9" style="display: none;"/> <li id="bullet_addon3_9" style="display: none;"/> <li id="bullet_option2_col4_9" style="display: none;"/> <li id="bullet_option2_col3_9" style="display: none;"/> <li id="bullet_option2_col2_9" style="display: none;"/> <li id="bullet_option2_col1_9" style="display: none;"/> <li id="bullet_option3_col4_9" style="display: none;"/> <li id="bullet_option3_col3_9" style="display: none;"/> <li id="bullet_option3_col2_9" style="display: none;"/> <li id="bullet_option3_col1_9" style="display: none;"/> <li id="bullet_option4_col4_9" style="display: none;"/> <li id="bullet_option4_col3_9" style="display: none;"/> <li id="bullet_option4_col2_9" style="display: none;"/> <li id="bullet_option4_col1_9" style="display: none;"/> <li id="bullet_option5_col4_9" style="display: none;"/> <li id="bullet_option5_col3_9" style="display: none;"/> <li id="bullet_option5_col2_9" style="display: none;"/> <li id="bullet_option5_col1_9" style="display: none;"/> <li id="bullet_5_9">Official Daytona 500 Race Week Program </li> <li id="bullet_6_9">Benchwarmer Sports Souvenir Ticket Protector and Lanyard </li> <li id="bullet_7_9">On Site Benchwarmer Tour Staff </li> <li id="bullet_8_9">All Taxes and Service Charges</li> I'm CLOSE, but since the style = "display:[space]none" my preg_replace doesn't catch it. Can anyone help me determine the correct preg_replace pattern to do this? $bl = $_POST['bulletlist']; $pattern = '|^.+?display:none.+?$|mi'; $bl = preg_replace($pattern,'',$bl); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpI found your use of ? rather... creative... Anyway, just add the condition "0 or more whitespace" to your regex. $pattern = '|^.+display:\w*none.+$|'; I found your use of ? rather... creative... Anyway, just add the condition "0 or more whitespace" to your regex. $pattern = '|^.+display:\w*none.+$|';