string - Replace subdomain name with other subdomain Using JavaScript? -
i'm trying replace subdomain name "news.domain.com/path/.." "mobile.domain.com/path/..", using javascript
any idea how achieve this?
i'm assuming want change string in generic format xxxx.domain.com/...
mobile.domain.com/...
. regexp should in javascript:
var oldpath = "news.domain.com/path/"; var newpath = oldpath.replace(/^[^.]*/, 'mobile')
Comments
Post a Comment