Possible Duplicate:
How can I get query string values?
Trying to get a regex (Javascript).
Input: url.html?id=14114&yolo=hahaha
Output: id=14114
yolo=hahaha
So this is what i have done so far: (\&|\?)(.*?)\=(.*?)
How do I also include the red circled regions?
Any word after the question mark (?) in a URL is considered to be a parameter which can hold values. The value for the corresponding parameter is given after the symbol "equals" (=). Multiple parameters can be passed through the URL by separating them with multiple "&".
@:%_\+~#= , to match the domain/sub domain name.
URL parameters are made of a key and a value, separated by an equal sign (=). Multiple parameters are each then separated by an ampersand (&).
Query parameters can be passed using the Router service or the queryParams directive. To access query parameters ActivatedRoute service needs to be used. Complex data types like arrays of objects can also be passed using query parameters however these data types need to be stringified before being passed.
How about this pattern:
(\?|\&)([^=]+)\=([^&]+)
Try using this:
[^&?]*?=[^&?]*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With