SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    new york
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ereg search in file

    Using the following script I can find the first instance of a word in italics in a html file.

    PHP Code:
    $file file_get_contents('test.htm');
    preg_match("~<em.*?>(.*?)</em>~si",$file,$result); 
    How can I modify this script to find all instances of italic words in a file?

    --Thanks

  2. #2
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    new york
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This works:

    PHP Code:
    if (preg_match_all("~<em.*?>(.*?)</em>~si"$html$resultPREG_SET_ORDER))
    {
        foreach(
    $result as $k => $v){
         echo (
    $result[$k][0]).'<br>';



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
  •