I do not understand regular expressions. I need to change an img tag formatted in this manner: <img class="special-class" (then custom srcs and whatever) />. I figure preg_replace would do the job or would there be something more effective?
I just need the regular expression way to search for the full img tag with that first class so i can replace it with another string saved as $buzz
To match a full img tag (with valid html and no unquoted
>in there):Don’t know what else you want…
$matchwill contain the full in[0]and the attributes (as string) in[1].If you want to match the class attribute:
edit
Huh this might work:
If I input:
it only replaces the last img and leaves the rest untouched.
Regex rules!