0

I need help with a regex to select this entire string %2526_ga%253d1.193373933.1506621463.1391436765&

this exact match is always there: %2526_ga%253d

there's always a random number like this, but don't focus on the period since there's other periods later in the URL similar to this: 1.193373933.1506621463.1391436765&

This is what I have so far:

var str = window.location.search.match('_ga%253d');
alert(str);
2
  • can the number part be any length or does it have the same amount of digits between periods every time? Does it always end with a &? Commented Apr 26, 2014 at 11:47
  • that's a good question. I'll have to test and check a couple times to see if the length of the number changes. Commented Apr 26, 2014 at 11:49

1 Answer 1

3

If you want your prefix plus any digits full stops until the first etcetera the regex below should do

/_ga%253d'([0-9\.])+&/
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.