Regular Expression Help

Discussion in 'Programming' started by trixs, Apr 20, 2008.

  1. #1
    Hiya,

    I am having issues trying to get figure out a regular expression to grab the alt attribute of an img tag.. Here is what I have so far but cant seem to actually get it to work.
    
              $regexp = "/<img|<image*alt=(\"|'??)([^\"|' >]*?)*\/>|>/siU";
              if (preg_match($regexp, $this->anchortext[$i], $matches)) {
                    $this->anchortext[$i] = $matches[3];
              }
    
    PHP:
    Any ideas?

    Thanks
     
    trixs, Apr 20, 2008 IP
  2. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60