I'll read more about RegEx in near future, but for now i can't get RegEx for the following:
?filter=aBcD07_1-&developer=true
Need to get only aBcD07_1-, without other. Can you please help and provide me a RegEx for javascript
Thanks!
I'll read more about RegEx in near future, but for now i can't get RegEx for the following:
?filter=aBcD07_1-&developer=true
Need to get only aBcD07_1-, without other. Can you please help and provide me a RegEx for javascript
Thanks!
Try with this one:
var rx = /[?&]filter=([a-zA-Z0-9_-]+).*/g;
var result = rx.exec(yourGetStr);
if (result && result.length == 2) {
alert (result[1]);
}
This regular expression will work even when filter
is not the first query parameter.
A simple substring
and indexOf
should do the trick.
var startIndex = str.indexOf('filter=') + 7;
str.substring(startIndex, str.indexOf('&', startIndex)); // returns "aBcD07_1"