/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// with protocol var url:String = "http://www.domain.com/?value=test&message=debug"; var reg:RegExp = /([a-z]*:\/\/)?([a-z-_]*)?.?[a-z-_]*.[a-z]*/; trace(url.match(reg)[0]); // http://www.domain.com // without base protocol var url:String = "http://www.domain.com/?value=test&message=debug"; var reg:RegExp = /[^https:\/\/]([a-z-_]*)?.?[a-z-_]*.[a-z]*/; trace(url.match(reg)[0]); // www.domain.com