views:

82

answers:

2

Anyone knows the Regexp for AS3 to get the domain name from URL? E.g: "http://www.google.com/translate" will get "http://www.google.com"

+1  A: 

There's is a very complete utility class for dealing with URIs in as3corelib. Perhaps you might want to use this instead of rolling your own.

import com.adobe.net.URI;
var uri:URI = new URI("http://www.google.com/translate");
trace(uri.authority); // traces www.google.com
Juan Pablo Califano
+1  A: 

Hi

This should do the work: http(s?)://([\w]+\.){1}([\w]+\.?)+ You can try this in GSkinner RegExr

OXMO456