PHP preq_replace replace wildcard string with html and wha happens after the wildcard : Hey I have a hard time understanding regex but I think that what suits my needs best currently have this line:

        $str = preg_replace('/https:\/\/clips.twitch.tv\/(.*?)/', '<iframe src="https://clips.twitch.tv/embed?autoplay=false&clip=$1&tt_content=embed&tt_medium=clips_embed" width="640" height="360" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>', $text);


What I want is to replace f.ex this link: https://clips.twitch.tv/GleamingHelpfulOxNotLikeThis

To be the HTML in the replace part, but the last part f.ex. "GleamingHelpfulOxNotLikeThis" ends up behind the iframe and not after "clip=" where I have $1 which I thought would work.

