title: NSScanner Looping retrieving multiple values
body: <p>I have the following text</p>
  
  <pre><code>&lt;select name="username"&gt;&lt;option value="177"&gt; Bob1
                  &lt;/option&gt;&lt;option value="221"&gt; Bob2
                  &lt;/option&gt;&lt;option value="227"&gt; Bob3
                  &lt;/option&gt;&lt;option value="164"&gt; Bob4
                  &lt;/option&gt;&lt;option value="271"&gt; Bob5
                  &lt;/option&gt;&lt;option value="137"&gt; Bob6
                  &lt;/option&gt;&lt;option value="105"&gt; Bob7
                  &lt;/option&gt;&lt;option value="285"&gt; Bob8
                  &lt;/option&gt;&lt;option value="281"&gt; Bob9
                  &lt;/option&gt;&lt;option value="265"&gt; Bob10
                  &lt;/option&gt;&lt;/select&gt;
  </code></pre>
  
  <p>And I am trying to use an NSScanner to get the option value and the name within the option tags.  So far I have the following code</p>
  
  <pre><code>for (int y = 1; y &lt; 16; y++) {
      NSScanner *scanner1 = [NSScanner scannerWithString:htmlsource];
      [scanner1 scanUpToString:[NSString stringWithFormat:@"&lt;option value=\""] intoString:NULL];
      [scanner1 scanString:[NSString stringWithFormat:@"&lt;option value=\""] intoString:NULL];
      [scanner1 scanUpToString:@"\"" intoString:&amp;result];
      NSLog(@"%i",[scanner1 scanLocation]);
      NSLog(result);
  
      [scanner1 setScanLocation:([scanner1 scanLocation] - 18)];
      [scanner1 scanUpToString:[NSString stringWithFormat:@"&lt;option value=\"%@\"&gt;",result] intoString:NULL];
      [scanner1 scanString:[NSString stringWithFormat:@"&lt;option value=\"%@\"&gt;",result] intoString:NULL];
      [scanner1 scanUpToString:@"&lt;/option&gt;" intoString:&amp;result];
      //NSLog([NSString stringWithFormat:@"&lt;option value=\"%@\"&gt;",result]);
      NSLog(@"%i",[scanner1 scanLocation]);
      NSLog(result);
  
      }
  </code></pre>
  
  <p>This works for the first entry only.  Am I going about this wrong or do I have to start the scan where it left off, if so how?
  Results so far are..</p>
  
  <pre><code>2009-07-31 08:15:53.859 App1[1000:20b] 683
  2009-07-31 08:15:53.860 App1[1000:20b] 177
  2009-07-31 08:15:53.860 App1[1000:20b] 712
  2009-07-31 08:15:53.860 App1[1000:20b] Bob1
  
  2009-07-31 08:15:53.861 App1[1000:20b] 683
  2009-07-31 08:15:53.861 App1[1000:20b] 177
  2009-07-31 08:15:53.862 App1[1000:20b] 712
  2009-07-31 08:15:53.862 App1[1000:20b] Bob1
  </code></pre>