Creating own input masks
<p>Basically I want to validate a string against a mask which is in the DB however to validate against it I need to assign a rule to that mask i.e <code>[D] = 0&lt;=10</code>.  So what I have done is retrieved that mask and extracted the [] from the letters and stored them in two different vectors, so my question is, that can you assign a rule to various cells with the vector </p>

<p>i.e </p>

<pre><code>a[0] = 0&lt;=10
a[1] = "H"
</code></pre>

<p>something along the lines of that below is my code bear in mind that the string in the top is not from the DB it is just a string i created assuming it is from the DB because the process will be the same</p>

<pre><code>string s("[sh][a][mar][i]");
    vector&lt; vector&lt;char&gt; &gt; Vect;
    vector&lt;char&gt; vect;
    int i = 0;
    while(i &lt; s.size()) {
        if(s[i]=='[') {
            i++;
            vect.push_back(s[i]);
            i++;

        }
        else if(s[i] == ']') {
            i++;
            Vect.push_back(vect);
            vect.clear();
        }
        else {
            vect.push_back(s[i]);
            i++;
        }
    }


    vector&lt; vector&lt;char&gt; &gt;::iterator it;
    vector&lt;char&gt;::iterator itera;
    vector&lt;std::string&gt; vectString;


    for (it = Vect.begin() ; it != Vect.end() ; ++it ) {
        string a;
        for (itera = it-&gt;begin() ; itera != it-&gt;end() ; ++itera) {
            cout &lt;&lt; *itera;
            a += *itera;

        }
        vectString.push_back(a);

    }
</code></pre>
