React-native – React Native – Parse URL to get Query Variable


Looking for a way to parse a URL to get a query variable in React Native received from Linking.

I'm receiving the URL as something like:


I'd like to get the someVar value from the URL.

Any thoughts?

Best Solution

This should do the trick

var url = ""var regex = /[?&]([^=#]+)=([^&#]*)/g,  params = {},  match;while (match = regex.exec(url)) {  params[match[1]] = match[2];}console.log(params)