regular expression in ios to remove href links

ios, nsregularexpression, regex

Solution

I think

NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"<a href=\"[^\"]+\">([^<]+)</a>" options:NSRegularExpressionCaseInsensitive error:&error];
NSString *modifiedString = [regex stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@"$1"];

should work (I tested the regexp in TextMate but not in XCode).

Problem

i need some help in building a regular expression to remove href links with search terms from a long string that i then parse into a web view an example of the href string : `<a href="/search/?search=Huntington">Huntington</a>` i would like to remove everthing but the plain text of the link (just the link itself) but having troubles ``` NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"<a href=\"/search/?search=([A-Z][a-z])\"" options:NSRegularExpressionCaseInsensitive error:&error]; ``` any help would be greatly welcomed Thanks

Original source