//string
NSString *haystack = @".test {test:test} .test2{dasf:asdF}";
//pattern
NSString *needle = @"[^{}]*{[^{}]*}";
What I want from this is .test {test:test} and .test2{dasf:asdF} in an array (rest of the code handles this) but for some reason this regexp is not working correctly because no results are found.
If
NSString *needle = @"[^{}]*";
I get the following
(
".test ",
"",
"test:test",
"",
" .test2",
"",
"dasf:asdF",
"",
""
)
which is expected. After a lot of fiddling it seems to be a problem with { and } in the regex but I can't think why.
Incidently, if anyone can explain why I get these empty elements in the array above that would be useful to know as well.
Thanks!