Version 14.0 beta (14A5228q) I'm getting errors when using the sample code at [3:49], in a playground. The code is below. The line with the .split throws an error, as does the switch statement. If the parameter named "separator" is replaced with "by", then the line works. Unable to fine a way to get the switch to work.
let input = "name: John Appleseed, user_id: 100" let regex = /user_id:\s*(\d+)/ input.firstMatch(of: regex) // Regex.Match<(Substring, Substring)> input.wholeMatch(of: regex) // nil input.prefixMatch(of: regex) // nil input.starts(with: regex) // false input.replacing(regex, with: "456") // "name: John Appleseed, 456" input.trimmingPrefix(regex) // "name: John Appleseed, user_id: 100" input.split(separator: /\s*,\s*/) // ["name: John Appleseed", "user_id: 100"]
switch "abc" { case /\w+/: print("It's a word!") }