

Task

   match a string against a regular expression
   substitute part of a string using a regular expression


import Foundation
 
let str = "I am a string"
if let range = str.rangeOfString("string$", options: .RegularExpressionSearch) {
  println("Ends with 'string'")
}