Comparing an URL to a given list of URL schemes in Javascript
<p>Using JavaScript I would like to check if a given URL matches a list of URL schemes. I have come this far:</p>

<pre><code>function on_wikipedia() {
    // the list of allowed locations
    var allowed_locations = new Array( "http://*.wikibooks.org/*"
                                     , "http://*.wikimedia.org/*"
                                     , "http://*.wikipedia.org/*"
                                     , "http://*.wikiquote.org/*"
                                     , "http://*.wikiversity.org/*"
                                     , "http://*.wiktionary.org/*"
                                     , "http://www.mediawiki.org/*"
                                     , "https://secure.wikimedia.org/*"
                                     );

    // current location; e.g. "http://en.wikipedia.org/wiki/Main_Page"
    var current_location = content.document.location;

    var valid = false;

    // compare current_location to allowed_locations and set valid to true,
    // if it matches
    //
    // FIXME

    return valid;
}
</code></pre>

<p>Maybe it is a bad idea to do it like this. Maybe I should use regular expressions to make the comparason? Unfortunately I'm lost... I have no JavaScript experience at all. Could someone please point me in the right direction?</p>
