Solved

Javascript regex

Posted on 2015-01-15
1
161 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now