Regular Expression to pull out part of a string

I need some help trying to select a certain part of a string with regular expression.

Here is the string.

http://site.com/bathroom.jpg&h=165&w=204&zc=1&q=90&a=c

And I need to select "&h=165&w=204&zc=1&q=90&a=c" part of it out.

Would regular expression be the best approach to this and if so, how?

Thanks...

Answers


Find the first & and take everything starting from it. The regex:

&.*

use substring like

function getSecondPart(str) {
    return str.split('jpg')[1];
}
// use the function:
alert(getSecondPart("http://site.com/bathroom.jpg&h=165&w=204&zc=1&q=90&a=c"));

Need Your Help

Manually build logistic regression model for prediction in R

r model regression building

I'm attempting to test a logistic regression model (e.g. 3 coefficients for 3 predictor variables, X1,X2,X3), on a dataset. I'm aware of how to test a model after i created the model object using,...

Flex Mobile Why persistNavigatorState=“true” and stage.setAspectRatio(StageAspectRatio.PORTRAIT) don't mix?

flex flex4 flexbuilder

Why can't I use persistNavigatorState="true" and stage.setAspectRatio(StageAspectRatio.PORTRAIT) together in initializing program.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.