Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
96
rated 0 times [  100] [ 4]  / answers: 1 / hits: 38988  / 12 Years ago, wed, july 18, 2012, 12:00:00

I am trying to remove



http://localhost:7001/


part from



http://localhost:7001/www.facebook.com


to get the output as



www.facebook.com


what is the regular expression that i can use to achieve this exact pattern?


More From » html

 Answers
7

To javascript you can use this code:



var URL = http://localhost:7001/www.facebook.com;
var newURL = URL.replace (/^[a-z]{4,5}:/{2}[a-z]{1,}:[0-9]{1,4}.(.*)/, '$1'); // http or https
alert (newURL);


Look at this code in action Here



Regards,
Victor


[#84166] Tuesday, July 17, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
daytonm

Total Points: 519
Total Questions: 83
Total Answers: 89

Location: Saudi Arabia
Member since Mon, Sep 5, 2022
2 Years ago
;