Hacker News new | ask | show | jobs
by johne 5566 days ago
What do you gain by wrapping Objective-C around your regex?

Me being vastly more productive. Extract all the http like URL's from a string and print them:

  for(id match in [searchString componentsMatchedByRegex:@"\\bhttps?://[a-zA-Z0-9\\-.]+(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\\\]*)+)?"]) {
    printf("URL: %s\n", [match UTF8String]);
  }
I dare you, I double dog dare you to do the same thing in three lines of code with C and PCRE.