正则表达式来从URL域 [英] Regexp to get domain from URL
本文介绍了正则表达式来从URL域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都知道正则表达式的AS3来从URL中的域名? 例如:http://www.google.com/translate将得到http://www.google.com
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"
推荐答案
有是与URI的处理中的的as3corelib 。也许你会想用滚动你自己的这个代替。
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
这篇关于正则表达式来从URL域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文