Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:09:51+00:00 2026-05-26T02:09:51+00:00

I just need to get the view code from youtube urls. The api is

  • 0

I just need to get the view code from youtube urls. The api is returning back strings that look like this:

http:\/\/www.youtube.com\/watch?v=XODUrTtvZks&feature=youtube_gdata_player

I need to get this part:

XODUrTtvZks

from the above, keep in mind that sometimes there may be additional parameters after the v=something like:

&feature=youtube_gdata_player

and sometimes there may not be. Can someone please provide the regex that would work in this situation and an example of how to use it using javascript?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:09:51+00:00Added an answer on May 26, 2026 at 2:09 am

    This snippet only matches on URL’s from youtube.com:

    var url = 'http://www.youtube.com/watch?v=XODUrTtvZks&feature=youtube_gdata_player';
    var matches = url.match(/^http[s]?:\/\/www.youtube.com\/watch\?\s*v=([^&]+)/i);
    
    if (matches) {
        var videoID = matches[1];
        // do stuff
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just need a little bit of Javascript to warn people that press the back
as you can see from the code below im just trying to get the
I am using http://code.google.com/apis/maps/documentation/geocoding/ api from google to get geolocation based on address. I
Just need get some vals located in application.ini(main ini) in the Controller plugin I
I need to get just the first item (actually, just the first key) off
I just need to know if WCF is platform independent like Webservices? Can the
I just need to rename JQgrid column dynamically as per user selection from a
I just need to know hot to create a CGLayer that has an image
I need to know it to correctly get filedata from POST dictionary. I want
I have an AsyncTask that get info from the web. Sometimes the connection fails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.