0

I need extract compile flags from xcodebuild output, So I want to get characters between "CompileC" and "-o"

I tried to do as in question described Regex Match all characters between two strings

I am using NSRegularExpression

CompileC.*?\-o  (match nothing)

CompileC.*?\-   (give characters between CompileC and first "-", but I need "-o")

it does not work, I had tried other versions, but i did not achieve good result.

How can I do that? what regexp should I use?

Update:

now works with NSRegularExpressionDotMatchesLineSeparators!

NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"CompileC.*?\-o "
                                                                       options:NSRegularExpressionDotMatchesLineSeparators
                                                                         error:&regexError];
Community
  • 1
  • 1
BergP
  • 3,453
  • 4
  • 33
  • 58

1 Answers1

1

CompileC.*?\-o should work. Make sure the dot can match newlines by activating this option in your regular expression constructor.

Ibrahim Najjar
  • 19,178
  • 4
  • 69
  • 95