On Tue, Jan 26, 2010 at 10:37 PM, Rob Gould <gould...@mac.com> wrote:

> It appears that IE renders it's display: none in all caps while Firefox and
> other browsers pass it back in lowercase.  This throws off my php line of
> code the is supposed to nuke blank bullets from a string of text:
> $bl =
> <LI style="DISPLAY: none" id=bullet_ug2_col5_8></LI>
> <LI style="DISPLAY: none" id=bullet_ug2_col4_8></LI>
> <LI style="DISPLAY: none" id=bullet_ug2_col3_8></LI>
> <LI style="DISPLAY: none" id=bullet_ug2_col2_8></LI>
> <LI style="DISPLAY: none" id=bullet_ug2_8></LI>
> <LI style="DISPLAY: none" id=bullet_ug1_col4_8></LI>
> <LI style="DISPLAY: list-item" id=bullet_ug1_col3_8>Reserved Frontstretch
> Tower Ticket to the NextEra Energy Resources 250 on Friday Night </LI>
> <LI style="DISPLAY: list-item" id=bullet_ug1_col2_8>Reserved Frontstretch
> Tower Ticket to the Camping World 300 on Saturday </LI>
> <LI style="DISPLAY: list-item" id=bullet_2_8>Reserved Frontstretch Tower
> Ticket to the Daytona 500 on Sunday </LI>
> <LI style="DISPLAY: none" id=bullet_addon_col2_8></LI>
> <LI style="DISPLAY: none" id=bullet_addon3_8></LI>
> <LI style="DISPLAY: none" id=bullet_option2_col4_8></LI>
> <LI style="DISPLAY: none" id=bullet_option2_col3_8></LI>
> <LI style="DISPLAY: none" id=bullet_option2_col2_8></LI>
> <LI style="DISPLAY: none" id=bullet_option2_col1_8></LI>
> <LI style="DISPLAY: none" id=bullet_option3_col4_8></LI>
> <LI style="DISPLAY: none" id=bullet_option3_col3_8></LI>
> <LI style="DISPLAY: none" id=bullet_option3_col2_8></LI>
> <LI style="DISPLAY: none" id=bullet_option3_col1_8></LI>
> <LI style="DISPLAY: none" id=bullet_option4_col4_8></LI>
> <LI style="DISPLAY: none" id=bullet_option4_col3_8></LI>
> I want to keep the "DISPLAY: list-item" lines, and nuke all the others.
> The below above are sent to PHP in a variable called $bl.  I then try to
> nuke the "DISPLAY: none" lines with something like:
> $pattern = '/<li[^>]*style="display: none[^>]*>/';
> $bl = preg_replace($pattern,'',$bl);
> $pattern = '/<li[^>]*style="DISPLAY: none[^>]*>/';
> $bl = preg_replace($pattern,'',$bl);
> But it appears that the case-sensitivity fix is not just a matter of making
> the letter capitals.  I'm sure someone who knows more than I about
> preg_replace will see the
> immediate error of my ways.  Any advice is greatly appreciated.
Your regex is looking for case-sensitive matches, which given the example
below, would preclude all of your list items (they all start with "<LI", not

Try using a case insensitive regex (e.g., $bl = preg_replace($pattern
= /<li[^>]*style="DISPLAY: none[^>]*>/i','',$bl);

(Note the "i" after the search pattern above.)


Nephtali:  PHP web framework that functions beautifully

Reply via email to