Regex Conditional Group ?

Looking at this article ... https://www.codeproject.com/Articles/21080/In-Depth-with-RegEx-Matching-Nested-Constructions, where it says The Push-down Automata roughly 1/4 way down, although am not sure the same will be using Swift. Apparently using (?<S>Agora)(?(S)(?!)|(.*)) should work but does not.


Any suggestions for using conditional group ?

Replies

The article is written for .NET RegEx, which is one dialect of regular expression.


Apple's `NSRegularExpression` is based on ICU regex and it does not support such feature as Push-down Automata.

See the documentation of NSRegularExpression.