title: How to get regex to grab all letters from an objective c string?
body: <p>I'm trying to get the following regular expression to grab only the letters from an alpha-numeric character input box, however it's always returning the full string, and not any of the A-Z letters.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>It needs to grab all the letters only. No weird characters and no numbers, just A-Z and put it into a string for me to use later on.</p>
  
  <pre><code>// A default follows
  NSString *TAXCODE = txtTaxCode.text;
  
  // Setup default for taxcode
  if ([TAXCODE length] ==0)
  {
      TAXCODE = @"647L";
  }
  
  
  NSError *error = NULL;
  NSRegularExpression *regex;
  
  regex = [NSRegularExpression regularExpressionWithPattern:@"/[^A-Z]/gi" 
                                                    options:NSRegularExpressionCaseInsensitive
                                                      error:&amp;error];
  
  NSLog(@"TAXCODE = %@", TAXCODE);
  NSLog(@"TAXCODE.length = %d", [TAXCODE length]);
  
  
  NSLog(@"STC (before regex) = %@", STC);
  
  
  STC = [regex stringByReplacingMatchesInString:TAXCODE
                                        options:0
                                          range:NSMakeRange(0, [TAXCODE length])
                                   withTemplate:@""];
  NSLog(@"STC (after regex) = %@", STC);
  </code></pre>
  
  <p>My debug output is as follows:</p>
  
  <blockquote>
    <p>TAXCODE = 647L </p>
    
    <p>TAXCODE.length = 4 </p>
    
    <p>STC (before regex) =  </p>
    
    <p>STC (after regex) = 647L</p>
  </blockquote>