-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
  • 430
  • 2
  • 10
Ben Pearce
  • 6,162
  • 16
  • 64
  • 122

1 Answers1

2
var c = yourString.match(/\/morestuff\/([^?]*)/)[1];
Crayon Violent
  • 30,524
  • 3
  • 51
  • 74