javascript - Replace forward slash with jQuery -
this string:
hello/page/2/bye
this have (please note "2" number, "page" "page":
hello/bye
how can str.replace() using jquery?
this (without jquery):
var str = 'hello/page/2/bye'; str = str.replace(/page\/\d+\//,'');
the slashes need escaped (so become \/
), \d+
number, 1 or more times (so matches e.g. page/12/
Comments
Post a Comment