Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NS-free regex pattern-finding implementation #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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