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

Pure Swift extension methods for getting substrings from RegularExpressionMatch.Range and Range<Int> #16

Merged
merged 7 commits into from
Dec 13, 2015
Merged

Pure Swift extension methods for getting substrings from RegularExpressionMatch.Range and Range<Int> #16

merged 7 commits into from
Dec 13, 2015

Conversation

cradnovich
Copy link
Contributor

Previous example code (e.g., in the RegularExpressionTests) relied on NSString and NSRange to obtain the matching string or the captured groups.

For example:

let stringRange = NSRange(match.range)

let matchString = (string as NSString).substringWithRange(stringRange)

With this code, it can be shortened, with a pure Swift implementation:

let matchString = string.substring(match.range)

Also added a test case for emoji support in RegularExpression that uses these methods.

@colemancda
Copy link
Member

Thanks :)

colemancda added a commit that referenced this pull request Dec 13, 2015
Pure Swift extension methods for getting substrings from RegularExpressionMatch.Range and Range<Int>
@colemancda colemancda merged commit a65a2f6 into PureSwift:develop Dec 13, 2015
@cradnovich cradnovich deleted the feature/regex-match-substring branch December 15, 2015 12:58
@cradnovich
Copy link
Contributor Author

You're welcome 😄

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