The task is to get the value of the parameter. The parameter value will be a string consisting of Latin letters and numbers of various combinations. Example:

sid=testcd52c49ecb525cb985 sid=52c49ecb525cb985 

Another parameter may follow the parameter value, the parameters are separated by the & symbol. Accordingly, I need to get only 52c49ecb525cb985 or testcd52c49ecb525cb985 and write to a variable.

I managed to get the value starting with a letter in this way:

 /sid=(\w+)/ 

Please tell me how to supplement the regular season.

  • @Expert added a question - vox

1 answer 1

 /sid=(testcd)?(\w+)/ 
  • the parameter can have the value 52c49ecb525cb985 or testcd52c49ecb525cb985, what format will come I can predict - vox
  • @helplz updated the jsfiddle.net/6Q4Xb/1 example - lampa
  • when I take the value of the parameter from the URL, it does not take place ((sid = (window.location.search.match (/ sid = \ w + /) || [null, null]) [1] - vox
  • @helplz I updated you an example. - lampa
  • @lampa thanks for the answers, but your example displays a lot of options, I need to get one line consisting of the Latin alphabet and numbers and write it into a variable. - vox