On Sat, Aug 8, 2009 at 11:14 PM, Rob Gould<gouldimg@xxxxxxx> wrote: > I have a bunch of bullets in a list coming from a previous post, and I need > to eliminate any line from this string that contains "display: none" > > > <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.php > > I found your use of ? rather... creative... Anyway, just add the condition "0 or more whitespace" to your regex. $pattern = '|^.+display:\w*none.+$|'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php