title: Finding date & time in NSString using Regex
body: <p>I want to do something similar to this question: <a href="https://stackoverflow.com/questions/5933498/regular-expression-in-ruby-for-strings-with-multiple-patterns">regular expression in ruby for strings with multiple patterns</a></p>
  
  <p>But I want to do it <code>Objective-C</code>. Basically I want extract date and time from a string with a date and time after the <code>@</code> sign.</p>
  
  <p>For example I have a string: <code>Feed the Rabbits @12</code>, I want to extract the date and time after the <code>@</code>, the problem is that the string can vary, for example it could <code>@12:00</code>, <code>@04/02/12</code>, <code>@04/02/12 12:00</code>, <code>@04/02/12 12:00</code> or just <code>@04/02/12</code>. Heres my current code to extract numbers from the string (it doesn't detect "/" or ":" so if the string is <code>@04/02/12</code> it will only extract <code>@04</code> because it stops at "/").</p>
  
  <p>I can also extract the <code>@12:00</code> part out using this RegEx pattern <code>@([0-9]+:[0-9][0-9])</code>.</p>
  
  <pre><code>NSString *regEx = @"@(\\d+)";
  
  NSString *dateString;
  r = [inputString rangeOfString:regEx options:NSRegularExpressionSearch];
  if (r.location != NSNotFound) 
  {
      dateString = [NSString stringWithFormat:@"%@",[inputString substringWithRange:r]];
      return dateString;
  } 
  else 
  {
      return @"";
  }
  </code></pre>