import Foundation
let pattern = #"\s+(?:ST|DR|AVE|TRL|BLVD|LN|CT|RD|CV|CMNS|CRK|XING|SQ|CRST|LNDG|LOOP|OVAL|ROW|TER|TRCE)\b.*"#
let regex = try! NSRegularExpression(pattern: pattern, options: .anchorsMatchLines)
let testString = #"""
505 BLACKBERRY
135 BEARDSLEY ST
15 HUNT CLUB DR
1223 STATE ROUTE 103
455 STATE RTE 43
206 COUNTY RD 4710
17 E 250TH ST
158 BALLINGER AVE SE
150 BALLINGER AVE S
18 BALLINGER AVE T
1272 ORANGE SUN TRL
291 S MORELAND BLVD
615 RUSSET WOOD LN
1165 MORROCCO CT
1321 S PKWY DR
250 COUNTY RD 25A S
22 SANSTONE RIDGE WAY
55070 MENDOZA TRL
1609 HUNTSMERE AVE DOWN
243 MISTY WOODS CV S
2292 BAYBERRY CMNS
16 KILDEER CRK
40 BEDFORD XING
4 LEXINGTON SQ
113 SPARROWS CRST
1082 MATHOM LNDG
1050 WILLOW RIDGE LOOP
660 REDTOP LOOP
8 MOUNT ROYAL LOOP
805 SIERRA OVAL
3012 NANTUCKET ROW
6 WOODROW AVE
943 DARROW PARK DR
743 BELVEDERE TER
189 WINCHESTER RD
19 WHITE OAK TRCE
890 BLACKJACK RD EXT
767 N EXCALIBUR DR
109 VININGS FOREST LN SE
508 E 141ST ST
85 ROSE LN ST SW
"""#
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