-2

Hi guys I'm trying to take a URL of the form

http://www.domainname.com/stuff/morestuff/content?extrastuff

And using a JavaScript string function parse out "content" based on the surrounding regular expressions "morestuff/" and "?". Any help would be greatly appreciated.

Qvcool
  • 460
  • 3
  • 10
Ben Pearce
  • 6,884
  • 18
  • 70
  • 127

1 Answers1

2
var c = yourString.match(/\/morestuff\/([^?]*)/)[1];
CrayonViolent
  • 32,111
  • 5
  • 56
  • 79