Javascript - Regex to remove an array of prefixes
<p>I need to remove a prefix from a string.  Given an array of known prefixes, I do not know which prefix will exist in a string. One and only one prefix will exist.</p>

<pre><code>    function CleanupSupportedItems(data) {
        var prefixes = new Array("TrialLeads", "IPG");

        for (var i = 0; i &lt; prefixes.length - 1; i++) {
            var prefix = new RegExp(/prefixes[i]/g);
            //alert(prefix);
            data = data.replace(prefix, "");
            alert(data);
        }
    }
</code></pre>

<p>The above code returns undefined on the second iteration. </p>

<p>Given the call</p>

<pre><code>CleanupSupportedItems("TrialLeads11");
</code></pre>

<p>I want a return value of "11".  How can I do it?</p>
