Regex and Recursion

Hi - I hope someone may be able to help me here.

I’m trying to build an NSRegularExpression within Swift and feed it this pattern

(?x) (?(DEFINE) (?<com>(?U:/\*((?:(?&com)|[\s\S])*\*/))) ) (--.*$) | (?&com)

I’m using a subroutine to recurse through and pattern match. I’m getting an error when constructing the NSRegularExpression telling me I’m passing in an invalid value. I’m guessing NSRegularExpression doesn’t support subroutines.

Any ideas out there how I can recurse within a RegEx expression that will work with Swift?

Many Thanks
Pat

OK - seems Swift uses the ICU RegEx engine which doesn’t support recursion.
(Link to RegEx Engine Comparisons)
(Link to ICU Userguide)

That kinda puts the kibosh on things! :unamused: