Swift Regex Replace
1
2
3
4
5
var str = "123ABC456 789abc012"
_ = str.replacingOccurrences(of: "[a-zA-Z]", with: "-", options: .regularExpress, range: nil)
// output
// 123---456 789---012
 This post is licensed under  CC BY 4.0  by the author.
1
2
3
4
5
var str = "123ABC456 789abc012"
_ = str.replacingOccurrences(of: "[a-zA-Z]", with: "-", options: .regularExpress, range: nil)
// output
// 123---456 789---012