i have a problem to get the whole query from the url using the toQueryParams function from the protoypejs framework e.G.:
var a = "http://anypage.com?a=lol&b=lal&c=laoa?&d=fehw#lalalalalSomeAnchor";
a.toQueryParams();
>> {d: 'fehw'}
what i want to get:
>> {a: 'lol', b: 'lal', c: 'loaa?', d: 'fehw'}
i know that url is invalid but i want to preprocess that url to escape its values before i sent it to the server.
I tried to change the functions regular expression to match only the chars between the first ? and the lastest #, i have already one expression /(\?.*#)/ which would work for me but i even want to exclude the ? and #, i hope someone of you can help me out 🙂
btw. that page below is awsome to build regexp in realtime 😛
http://regexpal.com/
Update: thanks to DaveRandom 🙂
for those who wants to fix that directly in the framwork replace following line with:
L625: var match = this.strip().match(/\?([^#]*)/); // (/([^?#]*)(#.*)?$/); default
How about this…
/\?([^#]*)/?You shouldn’t need to worry about matching up to the ‘last’
#because the anchor starts at the first#, therefore even if there is more than one#in the string, anything after the first occurence is not part of the query string.