Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
106
rated 0 times [  112] [ 6]  / answers: 1 / hits: 17821  / 14 Years ago, tue, october 26, 2010, 12:00:00
http://something.com:6688/remote/17/26/172


if I have the value 172 and I need to change the url to 175



http://something.com:6688/remote/17/26/175


how can i do that in JavaScript?


More From » javascript

 Answers
92
var url = http://something.com:6688/remote/17/26/172
url = url.replace(//[^/]*$/, '/175')


Translation: Find a slash / which is followed by any number * of non slash characters [^/] which is followed by end of string $.


[#95171] Saturday, October 23, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
frederickmohamedw

Total Points: 21
Total Questions: 123
Total Answers: 105

Location: The Bahamas
Member since Tue, Apr 27, 2021
3 Years ago
;