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 8552589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:27:23+00:00 2026-06-11T14:27:23+00:00

I have a concatenating javascript string that I need to parse and match &mediaID=334380

  • 0

I have a concatenating javascript string that I need to parse and match “&mediaID=334380” wherever it falls in the string. I need to be able to find “&mediaID=” and then write out the numbers that follow the = and have it end on “

This concatenating var will have only once instance of “&mediaID=334380” in it, but it may be in a different part of the string.

var vidPlyrVars = "vidPlayerSchool=" + vid_partner + "&vidPlayerWd=" + vid_width +      "&vidPlayerHt=" + vid_height + "&";
vidPlyrVars += "vidURL=" + vid_url + "&imgURL=" + img_url + "&color_button_bkg=0d141a" + "&color_controls_bkg=0d141a" + "&mediaID=334380" + "&share_buttons=on" + "&vip_url=http://somesite.com/all/index.html" + "&";
vidPlyrVars += "vidTitle=" + escape("some title") + "&";
vidPlyrVars += "autoplay=off&autoplay_refresh=always&full_screen=on&ad_prerolls=off&";
vidPlyrVars += "list_type=none&";

I just need the numbers after &mediaID= no matter how many numbers there are. I have tried splitting, but it wont work since the &mediaID= may be in a different location in the string.

*Also. What if the mediaID may or may not have a _ before ID such as media_ID and mediaID. Is there a way to match for both in one regex?

Thank you.

  • 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-06-11T14:27:24+00:00Added an answer on June 11, 2026 at 2:27 pm

    Regular expressions is the way to go here.

    Try this in your console:

    "asdasdasdasdasd&mediaID=645654654&asdasdasdasd=asdasdasdasdasd".match(/&mediaID=[0-9]+/)
    

    Also, if you want the number separatedly, you can use

    "asdasdasdasdasd&mediaID=645654654&asdasdasdasd=asdasdasdasdasd".match(/&mediaID=([0-9]+)/)
    

    [0-9]+ means any number from 0 to 9, that occurs at least once. And if you wrap it in parentheses, it’ll store it in the response (which is an array, by the way).

    Let me know if there’s any other doubt. Cheers!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some occasions where I need to build a string via JavaScript to
I have a List<List<String>> I need to get a List of all possible concatenation
HI, I want to dynamically concatenating the strings using C#. I have localized string
I'm struggling with some JavaScript code that I have used countless times across my
I have a problem concatenating two associative arrays in JavaScript. Below is the sample
I'm working on ant build for concatenating and minifying my javascript files. I have
I have a one-dimensional array of strings in JavaScript that I'd like to turn
I was told recently (on here) that concatenating your Javascript will cause XSS vulnerabilities.
We have (currently) working projects that use Javascript API to get the Facebook session
I'm using javascript and jquery, I have a string like var apiUrlAnswer = 'https://api.stackexchange.com/2.0/answers/{ids}?order=desc&sort=activity&site=stackoverflow';

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.