5

The documentation from Apple, Google searches, and StackOverflow is non-existent with regard to what RegEx engine XCode's Find Navigator uses, making it very difficult to write expressions. For example, I tried to do a negative lookbehind, and it doesn't work. Does anyone know where the hidden documentation lies?

1 Answer 1

2

Quick Answer: The ICU Engine. (This is the same engine that is used for NSRegularExpression as well).

Longer version:

The main difference between PCRE and ICU, the two leading regex engines, is PCRE's support for recursion within it's expressions. A simple example of this would be:

\w{3}\d{3}(?R)?

which matches aaa111bbb222 fully. However, entering this into an Xcode (7.1.1) regex find field yields this alert:

Find Failure: not a valid regular expression.

This leads us to believe that Xcode is using the ICU engine to power it's search and replace features. This make sense since Xcode is likely built either on top of NSRegularExpression or the underlying libicucore.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.