-2

Using regex I want to convert a URL of the following form:

https://example.com/employment/locationselect.aspx?pp=123default.aspx

to a url that redirects to:

https://example.com/employment/locationselect.aspx

How do I construct the regex that will do that?

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
  • Both of those urls are the same, with different query strings (the former has one the latter has none). Shouldn't the endpoint handling that url simply ignore query strings with the `pp` variable? Or altogether? Where does regex come in? – Nathaniel Ford Apr 16 '15 at 20:49

1 Answers1

1

cut of everything after aspx? ?

.* anything 0 to infinity times aspx\? = aspx?

.*aspx\?

u get the substring(s1) match for the regex and then make a substring(0,s1.size()-1) to get rid of the ?

or if u want to replace a substring

\?pp.*aspx

would match ?pp=123default.aspx

then u replace it with ""

Philipp
  • 137
  • 1
  • 2
  • 11