Solved

Javascript regex

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

895 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

22 Experts available now in Live!

Get 1:1 Help Now