Count the length of a string excluding a list of keywords?
<p>I am validating a number of fields based on the length of the string entered.  However, any of the values in the following array must NOT count against the string length:</p>

<pre><code>var omittedSubStrings = ["%KEYWORD%","{Keyword:AltText}","%CITY_STATE%","%CITY%","%KEYWORD%","%KEY_WORD%","%QUERY_KEYWORD%","%QUERY_KEY_WORD%","$CLICK_ID$","$LOCATION$","%URLENC_CITY%","%NOSPACE_CITY%","%STATE%","$USER_PLACEMENT_INV_ID$"];
</code></pre>

<p>so for example if my string is:</p>

<pre><code>var str = "Hello %CITY%";
</code></pre>

<p>I want to get the length of that string s.t it equals 6. Multiple variables can possibly be used in one string, and they must all not count against length.</p>

<p>Suggestions?</p>
