Thursday, 15 September 2011

javascript - how to split string between two characters? -



javascript - how to split string between two characters? -

how split target string betweeen /#/ , / chars?

http://www.site.com/#/target/

the output supposed target.

here fiddle regex required match text between lastly 2 slashes:

http://jsfiddle.net/7bgp5/

the code quite simple:

var str = "http://www.site.com/#/target/"; var regexp = /.*\/(.*?)\//; console.log(str.match(regexp)[1]);

javascript jquery regex split

No comments:

Post a Comment