Humanity

Edit the world by your favorite way

文字列からマッチしたもの全部取得

最近こんなのよくやる。

var text = "foo http://example.com/ bar http://google.com/ baz";
text.replace(
    /http:\/\/\S+/g,
    function (url) { alert(url); }
);