SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2000
    Location
    Seattle, WA area
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi everybody!

    I'm trying to use sscanf() to grab all the data in between various HTML tags.

    Here is my code:
    PHP Code:
    $n sscanf($line[7],"</font></td><td valign=\"top\"><font face=\"Arial, Helvetica\" size=\"2\">%s</font>", &$var1); 
    The problem is is that when the set to be replaced has a space in it, it only grabs the first word (without the space). For example, if the string was "We test the program", it would return "We" for $var1.

    I need it to return the whole string ("We test the program") for $var1 and not just the first word. Any ideas on how I would go about this?

    Thanks.

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    First, check the first user note under sscanf() at:

    www.php.net

    Second, if you don't want to reformat the data between the tags, sscanf() does not seem like the appropriate function. Try preg_match_all().
    Last edited by 7stud; Apr 16, 2001 at 13:43.

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2000
    Location
    Seattle, WA area
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would I acheive this using preg_match_all?

    Thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •