#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    0
    Rep Power
    0
    Hi,

    I'm writing a Palm Pilot portal that allows users to see the Palm Pilotized version of any website. Basically, they input a URL and ALL HTML tags except for <br>,<p>, and <a...></a> get stripped. What I'm doing now is this:
    $content = get $url;
    #$content =~ s/<style.*?/style>//gi;
    #$content =~ s/<!.*?>//gi;
    #$content =~ s/<br>/--break--/gi;
    #$content =~ s/<p>/--break-- --break--/gi;
    #$content =~ s/<a/--startlink--/gi;
    #$content =~ s/</a>/--endlink--/gi;
    #$content =~ s/<.*?>//g;
    #$content =~ s/--startlink--/<a/gi;
    #$content =~ s/--endlink--/</a>/gi;
    #$content =~ s/--break--/<br>/gi;

    but the problem I run into w/ that is that the stuff between style and script tags isn't being removed and it doesn't really look good.

    Any suggestions?

    -Intaglio
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Location
    Ft. Lauderdale, FL, US
    Posts
    29
    Rep Power
    0
    remember that . matches everything except newline characters, so, it may be that it's not getting stripped for that reason.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2000
    Posts
    0
    Rep Power
    0
    Instead of /gi, use /gis and newlines will be included.

IMN logo majestic logo threadwatch logo seochat tools logo