On 6/7/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> 
> Your RegEx is probably fine...
> 
> But you are probably missing a closing quote in lines BEFORE line 39, and
> PHP thinks everything up the the =====^ is still part of some giant
> monster long string that spans multiple lines, and then it gets to the
> /head bit (because  your opening quote is really a closing quote for
> something way earlier) and BAM!  /head don't mean nothing useful in PHP...
> 
> So all this discussion about security, strip_tags, and suchlike has
> nothing to do with your original problem :-)
> 
> But, hey, ya learned some stuff, and that's never bad. :-)
> 
> On Sun, June 5, 2005 6:36 pm, Dotan Cohen said:
> > On 6/6/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> >> On Sun, June 5, 2005 7:05 am, Dotan Cohen said:
> >> > I took this example from php.net, but can't figure out where I went
> >> > wrong. Why does this:
> >> > $text = preg_replace("/<head(.|\s)*?>(.|\s)*?<\/head>/i" , "" ,
> >> $text);
> >> >
> >> > throw this error:
> >> > syntax error at line 265, column 39:
> >> >               $text = preg_replace("/<head(.|\s)*?>(.|\s)*?<\/head>/i"
> >> , "" , $text);
> >> > ======================================^
> >> >
> >> > It seems to be pointing to the 'e' is 'head'. Why? Thanks.
> >>
> >> The pointing is often "off" by a few chars...
> >>
> >> For starters, you're not correctly using \, imho.
> >>
> >> \ is special in PHP strings.
> >> \ is ALSO special in RegEx.
> >>
> >> So your \s should be \\s, in case PHP makes \s special someday.
> >>
> >> I think the ?> in there will also mess you up, maybe, as that ends PHP
> >> parsing...  Though it SHOULD be kosher inside a string...
> >>
> >> --
> >> Like Music?
> >> http://l-i-e.com/artists.htm
> >>
> >>
> >
> > Could well be- I certainly didn't come up with that regex myself! What
> > would you recommend to remove any tag, and the code enclosed? For
> > instance: "I love my <tag>big</tag> brother" would become "I love my
> > brother"?
> >
> > Dotan
> > http://lyricslist.com/lyrics/pages/artist_albums.php/114/Chapman%2C%20Tracy
> > Tracy Chapman Lyrics
> >
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> Like Music?
> http://l-i-e.com/artists.htm
> 

You're right! The problem wasn't the regex- it was in getting the
parge to parse. I stated that in my second post- after I figured it
out. And again in another post. But the thread changed subject, as I
followed it...

I didn't know that there could be / are virus for mobile phones. Of
course I don't need all that fancy markup- truth is that I hate it. I
was modifying someone else's script and didn't want to hack it up too
much. But now I see that I'm better off removing all the tags like you
suggest.

Thanks to everyone who contributed to this thread. From you I learn.

http://lyricslist.com/lyrics/pages/artist_albums.php/425/Red%20Hot%20Chili%20Peppers
Red Hot Chili Peppers Lyrics

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to