iOS Regex: Unknown escape sequence “\\|”
I'm getting a weird warning, and as a result my regex search isn't working. Here's the line: NSRange r = [HTML rangeOfString:@"\|(.*)\|" options:NSRegularExpressionSearch]; Where HTML is a string that I'm sure contains a single match for the above regex. The warning is only on the first occurrence of "\|", not on both. Any help is much appreciated! You're getting the warning because \| is not a valid escape sequence in Objective-C (or C or C++ for that matter). The compiler is ignoring that and just using a raw | character instead, so the string you're actually passing in is @"|(.*)|" . To get