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/

demo: http://jsfiddle.net/dd5aohbc/


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -

html - href attribute breaking an element -