Avatar
Avatar
ainame
@swift-5.7.3 let pattern = #"Hello, (?<world>.*)"# let regexRuntime = try Regex(pattern) let matches = "Hello, Swift".matches(of: regexRuntime) if let m = matches[0].as((Substring, world: Substring).self) { print(m.world) }
swift57 BOT 7/2/2022 1:28 AM
exit status: 1 with stderr:<stdin>:2:24: error: cannot find 'Regex' in scope let regexRuntime = try Regex(pattern) ^~~~~ <stdin>:3:30: error: value of type 'String' has no member 'matches' let matches = "Hello, Swift".matches(of: regexRuntime) ~~~~~~~~~~~~~~ ^~~~~~~