Solved

Javascript regex

Posted on 2015-01-15
1
169 Views
Last Modified: 2015-01-15
Hi,

I want to match everything in this string from "sort" to the ampersand but not including it

var string = "somedomain.com?sort=prod.name_asc&rowspp=10";

the regex I'm using is /sort=(.*?)[^&]*/g

This works, but it doesn't in Javascript ...

Many thanks!
0
Comment
Question by:daisydoos
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 40550773
/sort=([^&]*)/
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question