Github Copilot wrote me code to embed youtube videos. Let's deploy.

```

const youtubeRegex = /(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w-]{11})(?:\S+)?/g;

replacedText = reactStringReplace(replacedText, youtubeRegex, (match, i) => {

return (

key={match + i}

width="560"

height="315"

src={`https://www.youtube.com/embed/${match}`}

frameBorder="0"

allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"

allowFullScreen

/>

);

});

```

Reply to this note

Please Login to reply.

Discussion

Sweet!