Skip to content

Conversation

@photovirus
Copy link

@photovirus photovirus commented Dec 9, 2022

NSRegularExpression doesn't exist in Apple's Foundation linux port. This branch uses a recursive parser based on Foundation String.range() method to process regex.

@photovirus photovirus force-pushed the legacy-interpolator-fix branch from 9687b2e to cfe5504 Compare December 9, 2022 14:39
@photovirus photovirus changed the title fix: new NS-free regex pattern-finding implementation NS-free regex pattern-finding implementation Dec 9, 2022
@photovirus
Copy link
Author

photovirus commented Dec 9, 2022

Another option I considered is Regex type introduced in Swift 5.7. Unfortunately, it isn't implemented in Foundation linux port as well.

I tried it in photovirus:regex-interpolator. That one is literally 5 lines of code.

@miroslavkovac
Copy link
Owner

@photovirus did you try doing some benchmarking before/after? I am curious what is the impact on the performance.

@photovirus
Copy link
Author

@photovirus did you try doing some benchmarking before/after? I am curious what is the impact on the performance.

Nope, I couldn't. Unfortunately, String.range() is the only way to use regex on non-Apple platforms, as Linux Foundation port supports neither NSRegularExpression, nor the newer Regex.

I couldn't compile my code on Linux, which is why I forked the repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants