how to append some string in img src by regularexpression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agradip
    New Member
    • Jan 2007
    • 1

    #1

    how to append some string in img src by regularexpression

    i have query regarding regular expression

    when i am grabbing url content i need to add the img src path as per the specified url

    i want to append a text after img src by matching though regular expression ,
    like
    suppose <img src="top.gif">
    i want make it like <img src="www.bastio ncoup.com/top.gif">
    Last edited by agradip; Jan 10 '07, 12:21 PM. Reason: spelling mistake
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    I think the preg_replace function should do the trick. What do you want to match?
    Code:
    <img src="top.gif">
    or
    Code:
    <img [I]anything here[/I] src="[I]somefile[/I]" [I]anything here[/I]>
    and replace somefile with the url + somefile?

    Comment

    Working...