import Foundation
let pattern = #"([0-9A-f]{2}[:-]){5}[0-9A-f]{2}"#
let regex = try! NSRegularExpression(pattern: pattern, options: .anchorsMatchLines)
let testString = #"""
1031AP9 2 AIR-CAP3502I-A-K9 2c:54:2d:0a:1a:1e default location US 10.10.131.108 0 [0 ,0 ,0 ]
1031AP4 2 AIR-CAP3502I-A-K9 2c:54:2d:0d:d6:d0 default location US 10.10.131.94 1 [0 ,0 ,0 ]
1031AP5 2 AIR-CAP3502I-A-K9 2c:54:2d:13:04:d5 default location US 10.10.131.107 6 [0 ,0 ,0 ]
1031AP11 2 AIR-CAP3702I-B-K9 a0:e0:af:6a:80:a4 default location US 10.10.131.106 1 [0 ,0 ,0 ]
1031AP6 2 AIR-CAP3502I-A-K9 2c:54:2d:13:05:24 default location US 10.10.131.101 1 [0 ,0 ,0 ]
1031AP2 2 AIR-CAP3502I-A-K9 2c:54:2d:0a:1b:f4 default location US 10.10.131.109 0 [0 ,0 ,0 ]
1031AP3 2 AIR-CAP3502I-A-K9 2c:54:2d:0a:1a:c6 default location US 10.10.131.104 0 [0 ,0 ,0 ]
1031AP8 2 AIR-CAP3702I-B-K9 d4:c9:3c:9d:4a:f4 default location US 10.10.131.114 3 [0 ,0 ,0 ]
1031AP1 2 AIR-CAP3502I-A-K9 2c:54:2d:0d:d7:11 default location US 10.10.131.105 3 [0 ,0 ,0 ]
1031AP7 2 AIR-CAP3502I-A-K9 2c:54:2d:0a:1c:21 default location US 10.10.131.93 0 [0 ,0 ,0 ]
1031AP10 2 AIR-CAP3502I-A-K9 2c:54:2d:13:02:53 default location US 10.10.131.103 0 [0 ,0 ,0 ]
"""#
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let substitutionString = #" "#
let result = regex.stringByReplacingMatches(in: testString, range: stringRange, withTemplate: substitutionString)
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Swift 5.2, please visit: https://developer.apple.com/documentation/foundation/nsregularexpression