MyBB Community Forums

Full Version: Add Custom MyCode for Youtube Embed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a question.

I have a button in my sceditor thats adds a [ YT ][ /YT ].

I have also created a MyCode entry with he following ReGex :

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

And the replacement :

[video=youtube]https://www.youtube.com/watch?v=$1[/video]


And if i post the reply it only parses 1 video fine , but 2 or more is not being shown, inclusive the text between videos.

The default [ video=youtube ] works fine instead . The video count limit is set to 5.

If i try to put the iframe code into the replacement field - > its not being parsed at all.

Is there something i am doing wrong ?

Thank you
Ok i figured out what the problem was : my regex expression wasnt right .

I have changed it to
\[YT\](?:https?://)?(?:www\.)?(?:youtu\.be/|youtube\.com(?:/embed/|/v/|/watch\?v=|/watch\?.+&v=))([A-Za-z0-9_-]{11}).?\[/YT\]

and now everything works fine