javascript - jquery / Get only number after particular word -
href="something.do?something_id=-1&something=u_container_id=6445194287^something=70a6c7ca4f9d52001cb17e918110c72f"; href1="something.do?something=u_container_id=7757033893"; var id = href1.substr(href1.lastindexof("=") + 1 , href1.length);
this work href1 not href. need make code container_id value. can 10 digits or less or more numbers
you can use match()
capturing group regex
href = "something.do?something_id=-1&something=u_container_id=6445194287^something=70a6c7ca4f9d52001cb17e918110c72f"; href1 = "something.do?something=u_container_id=7757033893"; var id = href1.substr(href1.lastindexof("=") + 1, href1.length); var id = href1.match(/container_id=(\d+)/)[1]; document.write(id);
Comments
Post a Comment