<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Okay thanks for taking a look I will have a better implementation ready for August 1st. <br><br>Alvarado, Joshua</div><div><br>On Jul 25, 2016, at 11:14 AM, Will Field-Thompson <<a href="mailto:will.a.ft@gmail.com">will.a.ft@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">The date for Swift 4 proposals is August 1 (<a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160711/024424.html">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160711/024424.html</a>), so you might want to try posting this again then.</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 25, 2016 at 12:55 PM Brandon Knope via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">There has been talk on this list of adding a fully featured RegEx feature. It has been pushed back to a later release as the window for Swift 3 is closing</div><div style="word-wrap:break-word"><div><br></div><div>Brandon</div></div><div style="word-wrap:break-word"><div><br><div><blockquote type="cite"><div>On Jul 25, 2016, at 12:24 PM, Joshua Alvarado via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div style="word-wrap:break-word"><pre style="white-space:pre-wrap;background-color:rgb(255,255,255)"><div style="margin:0px;line-height:normal;font-family:Menlo"><span>My first proposal so take it easy on me :) This is a draft so feedback is very welcome and any help. Thank you swiftys.</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span><br></span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>*Introduction*</span></div><div style="margin:0px;line-height:normal;font-family:Menlo;min-height:14px"><span></span><br></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>Swift doesn’t have a native implementation of Regex which is included in many other languages. This proposal is a suggestion to introduce a native Regex type into Swift. </span></div><div style="margin:0px;line-height:normal;font-family:Menlo;min-height:14px"><span></span><br></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>*Motivation*</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>Working with NSRegularExpression is not very swift like and it is lacking in ease of use. More motivation comes from also comes from one of the goals of swift with Swiftification of imported Objective-C APIs.</span></div><div style="margin:0px;line-height:normal;font-family:Menlo;min-height:14px"><span></span><br></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>*Proposed solution*</span></div><div style="margin:0px;line-height:normal;font-family:Menlo;min-height:14px"><span></span><br></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>Add a struct of Regex that can be used with the String type.</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span><br></span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>Regex can be initialized with a String pattern of the Regex and have simple properties such as accessing the pattern and toString of the pattern.</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span><br></span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>String to be extended for Regex support. Functions to add be:</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span><br></span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>mutating func replace(regex: Regex, withString: String)</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>search(regex: Regex) -> Character.Index</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>match(regex: Regex) -> Match? // Match is another new type</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span><br></span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>Match is a new type that can give more information on a regex match. Match will have properties such as numberOfMatches, components (the substring of matches in an array), and rangeOfMatch.</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span><br></span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>*Impact on existing code*</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>NSRegularExpression will stay and can still be used in combination, but a more swift like implementation will be out of the box in Swift.</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span><br></span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>*Alternatives considered*</span></div><div style="margin:0px;line-height:normal;font-family:Menlo"><span>Regex could be a protocol added to String for matching.</span></div><div style="margin:0px;line-height:normal;font-family:Helvetica;min-height:14px"><span></span><br></div>
</pre></div>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div></div>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>
</div></blockquote></body></html>