import Foundation
let pattern = #"([A-Z][A-Z|a-z|\-|’|'|.]*( | - ))+([A-Z][A-Z|a-z|\-|'|’|.]*)"#
let regex = try! NSRegularExpression(pattern: pattern, options: .anchorsMatchLines)
let testString = #"""
Yashlin Hernandez Ortiz
Hanna King-Ashley
Jason Gray Jr.
Nate D. Ashabraner
James A Basham
J S Smith
T.J. Smith
K. P. Sifuentes
Dawn-Marie Spisak
Jenny Smith - Jones
D’leon Starnes
Joe Rowlings-pimentel
Jd Robinson
LJ Reighard
Seylin Ramirez-Collier Gomez
Isabel McCool-Bonilla
Gladys Lena Danie Kousok
Daniel De La Paz
One
One Two
One Two Three Four Five - Six ' Seven-eight Nine
Randy Bagwell and Corey Norris
Jenny Smith - Jones Ana and another Womwn In
Yashlin Hernandez Ortiz
Hanna King-Ashley
Jason Gray Jr.
Nate D. Ashabraner
James A Basham
J S Smith
T.J. Smith
K. P. Sifuentes
Dawn-Marie Spisak
Jenny Smith - Jones
D’leon Starnes
Joe Rowlings-pimentel
Jd Robinson
LJ Reighard
Seylin Ramirez-Collier Gomez
Isabel McCool-Bonilla
Gladys Lena Danie Kousok
Daniel De La Paz
Asummer like no other, students were consumed with whether or not their sport will have a season and how it will be different. The summer of questions and unknowns, kept students waiting.
When summer kicked off, students didn’t know how the season would look. Freshman Jaden Allen and other players walked to football practice the first day expecting to be getting gear to play and instead got a work out assigned.
“This season has been so different from past years,” Allen said. “We were not allowed any gear until Sept. 7 due to UIL guidelines. We did the entire summer without gear which was crazy.”
Volleyball players were told to wear masks and socially distance, as was tennis.
“It wasn’t a life-changing season like football, but it was different,” senior Lilly Taylor said. “Socially distancing on a small court is hard and a challenge to follow the guideline, but we made it work in order to practice.”
Band was not without shortcomings either.
“Our band camp was pushed back due to planning and how we were going to abide by the guidelines,” senior drum major Annie Mazon said. “The directors made sure to be on us about masks ensuring our safety and preserving our band season.”
The effect COVID-19 had on clubs and sports alike during the summer season helped students to enjoy what they had at the moment.
“I could not be more thankful to be back and have a possible season with my friends,” Mazon said.
Story by Ashlyn Vozeh
Summer of Spikes
Coming back to practice after a break from COVID-19, players are eager to hit the court Aug. 18. Seniors Ashley Campbell and Hailey Huddleston were on the front line in a 6 vs. 6 scrimmage. “Our practices were a chance to catch up after so long and get ready for our season,” Huddleston said. “The feeling of getting to spike the ball again was amazing,” Photo by Ashlyn Vozeh
As band camp kicked off on Aug. 6, senior Hannah Sawyer leads her line of clarinets through the new band routine. “We had to wear masks during transitions and socially distance as much as possible during the season,” Sawyer said. “We were all just doing what we had to do in order to make this marching season the best one yet.” Photo by Claire Kennedy
“The famous Trumpeteers, Randy Bagwell and Corey Norris, practice their marching.”
"""#
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let matches = regex.matches(in: testString, range: stringRange)
var result: [[String]] = []
for match in matches {
var groups: [String] = []
for rangeIndex in 1 ..< match.numberOfRanges {
let nsRange = match.range(at: rangeIndex)
guard !NSEqualRanges(nsRange, NSMakeRange(NSNotFound, 0)) else { continue }
let string = (testString as NSString).substring(with: nsRange)
groups.append(string)
}
if !groups.isEmpty {
result.append(groups)
}
}
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