[swift-corelibs-dev] NSRegularExpression.escapedPatternForString() unimplemented on Linux

Philippe Hausler phausler at apple.com
Fri Feb 26 09:16:49 CST 2016


To be honest I just didn’t get around to implementing that specific method in my initial implementation. There is a CF function that does that which could be wired up to provide a nearly identical backing to it. 

CFStringRef _CFRegularExpressionCreateEscapedPattern(CFStringRef pattern)

should give you a good starting point to implement the NSRegularExpression side that should follow the same logic as the objective-c version.

> On Feb 26, 2016, at 3:28 AM, Pushkar N Kulkarni via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> 
> Hello, 
> 
> I have a query regarding NSRegularExpression. I can see that the class method escapedPatternForString(),  that escapes all characters in a string which could be treated as metacharacters, is unimplemented as per the latest dev snapshot for Linux.
> 
> Welcome to Swift version 3.0-dev (LLVM f95d47afa7, Clang f66c5bb67b, Swift b745691a38). Type :help for assistance.
> 
>   1> import Foundation
> 
>   2> NSRegularExpression.escapedPatternForString("a+b")
> 
> fatal error: escapedPatternForString is not yet implemented: file Foundation/NSRegularExpression.swift, line 84
> 
> 
> However, I see that this method is available on Swift 2.2-dev for OS X. 
> 
> Could someone please tell me the rationale behind having it unimplemented for Linux? Were there any Linux-specific obstacles implementing it? We would be glad to contribute here.
> 
> Thanks in advance.
> 
> Pushkar N Kulkarni
> IBM Runtimes
>  
>  
> "Any sufficiently advanced technology is indistinguishable from magic." - Arthur Clarke
> 
> _______________________________________________
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160226/f3f48866/attachment.html>


More information about the swift-corelibs-dev mailing list