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 -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -