import Foundation
let pattern = #"(\[)((\/?vc_)|(divider)|(image_)|(nectar_))([\w\s="'\-_.\/,:?&\/;%]*)(\])"#
let regex = try! NSRegularExpression(pattern: pattern, options: .anchorsMatchLines)
let testString = #"""
<wp:status>publish</wp:status>
<pubDate>Thu, 21 Jul 2022 14:19:17 +0000</pubDate>
<wp:post_date>2022-07-21 14:19:17</wp:post_date>
<wp:post_date_gmt>2022-07-21 14:19:17</wp:post_date_gmt>
<category domain="post_tag" nicename="architect"><![CDATA[architect]]></category>
<category domain="post_tag" nicename="bernardo-wills"><![CDATA[bernardo wills]]></category>
<category domain="post_tag" nicename="city"><![CDATA[city]]></category>
<category domain="post_tag" nicename="coeur-dalene"><![CDATA[coeur d'alene]]></category>
<category domain="post_tag" nicename="design"><![CDATA[design]]></category>
<category domain="post_tag" nicename="landscape"><![CDATA[landscape]]></category>
<category domain="post_tag" nicename="mceuen-park"><![CDATA[mceuen park]]></category>
<category domain="post_tag" nicename="north-idaho"><![CDATA[north idaho]]></category>
<category domain="post_tag" nicename="park"><![CDATA[park]]></category>
<category domain="post_tag" nicename="planning"><![CDATA[planning]]></category>
<category domain="category" nicename="architecture"><![CDATA[Architecture]]></category>
<category domain="category" nicename="landscape-design"><![CDATA[Landscape Design]]></category>
<category domain="category" nicename="news"><![CDATA[News]]></category>
<dc:creator />
<wp:comment_status>open</wp:comment_status>
</item>
<item>
<title>Riverfront Park North Bank and Ice Age Floods Playground</title>
<link>/blog/riverfront-park-north-bank-and-ice-age-floods-playground</link>
<content:encoded><![CDATA[<p>
<div data-contents="true">
<div class="" data-block="true" data-editor="3h4f0" data-offset-key="f1lji-0-0">
<div class="_1mf _1mj" data-offset-key="f1lji-0-0"><span data-offset-key="f1lji-0-0">This week we are reflecting on some of the highlights from 2021 – one of which is the completion and opening of the North Bank Regional Playground in Riverfront Park. The North Bank Regional Playground project is one of five major park elements identified in the Riverfront Park Master Plan that was funded in 2014 with a $64 million bond to redevelop the park. The site includes a themed regional playground, splash pad, open play area, specialty basketball court, wheels park, landscaping, lighting, new maintenance and operations/public restroom facility, and parking with innovative stormwater solutions. The one-acre Ice Age Floods Playground was designed as an outdoor learning and play experience that tells the story of how the Ice Age Floods shaped our region. Because of the dynamic nature of the Ice Age Floods and the rich imagery of its components, the story was transformed into an exciting play environment that also offers, multi-generational learning opportunities. It aims to provide a completely interactive and fun way for children, families and interested people to learn about our region’s unique geologic history.</span></div>
</div>
<div class="" data-block="true" data-editor="3h4f0" data-offset-key="1gltj-0-0">
<div class="_1mf _1mj" data-offset-key="1gltj-0-0"><span data-offset-key="1gltj-0-0"> </span></div>
</div>
<div class="" data-block="true" data-editor="3h4f0" data-offset-key="7nomr-0-0">
<div class="_1mf _1mj" data-offset-key="7nomr-0-0"><span data-offset-key="7nomr-0-0">The goal of the playground was to create an adaptive, safe, dynamic, high-quality nature-based play/learn environment for children of all abilities and their families. Bernardo Wills Architects led a large consultant group that included our in-house architecture team.</span></div>
</div>
</div>
<p></p>]]></content:encoded>
<excerpt:encoded><![CDATA[<p>This week we are reflecting on some of the highlights from 2021 – one of which is the completion and opening of the North Bank Regional Playground in Riverfront Park.</p>]]></excerpt:encoded>
<wp:post_name>riverfront-park-north-bank-and-ice-age-floods-playground</wp:post_name>
<wp:post_type>post</wp:post_type>
<wp:post_id>24</wp:post_id>
<wp:status>publish</wp:status>
<pubDate>Mon, 27 Dec 2021 16:18:57 +0000</pubDate>
<wp:post_date>2021-12-27 16:18:57</wp:post_date>
<wp:post_date_gmt>2021-12-27 16:18:57</wp:post_date_gmt>
<category domain="post_tag" nicename="architects"><![CDATA[architects]]></category>
<category domain="post_tag" nicename="bernardo-wills"><![CDATA[bernardo wills]]></category>
<category domain="post_tag" nicename="landscape-architect"><![CDATA[landscape architect]]></category>
<category domain="post_tag" nicename="north-bank"><![CDATA[north bank]]></category>
<category domain="post_tag" nicename="park"><![CDATA[park]]></category>
<category domain="post_tag" nicename="playground"><![CDATA[playground]]></category>
<category domain="post_tag" nicename="river"><![CDATA[river]]></category>
<category domain="post_tag" nicename="spokane"><![CDATA[Spokane]]></category>
<category domain="category" nicename="architecture"><![CDATA[Architecture]]></category>
<category domain="category" nicename="construction"><![CDATA[Construction]]></category>
<category domain="category" nicename="landscape-design"><![CDATA[Landscape Design]]></category>
<category domain="category" nicename="news"><![CDATA[News]]></category>
<dc:creator />
<wp:comment_status>open</wp:comment_status>
</item>
<item>
<title>Vietnam Veterans Memorial</title>
<link>/blog/vietnam-veterans-memorial-rededication</link>
<content:encoded><![CDATA[<p><span data-sheets-value="{"1":2,"2":"Veterans Day was even more special for our Bernardo Wills Architects design team, as we got to celebrate the redesign and rededication of the Vietnam Veterans Memorial in Riverfront Park. The new design includes a plaza that is wheelchair accessible, new benches, a decorative hand rail, and lighting. We are proud to have donated our design services for this important memorial to our local veterans.\n\nhttps://www.spokesman.com/stories/2021/nov/11/vietnam-veterans-reminisce-heal-as-spokane-rededic/"}" data-sheets-userformat="{"2":1053547,"3":{"1":0},"4":{"1":2,"2":12081720},"6":{"1":[{"1":2,"2":0,"5":{"1":2,"2":0}},{"1":0,"2":0,"3":3},{"1":1,"2":0,"4":1}]},"8":{"1":[{"1":2,"2":0,"5":{"1":2,"2":0}},{"1":0,"2":0,"3":3},{"1":1,"2":0,"4":1}]},"9":1,"11":4,"12":0,"15":"arial,sans,sans-serif","23":1}" data-sheets-textstyleruns="{"1":0}{"1":402,"2":{"2":{"1":2,"2":0}}}{"1":403,"2":{"2":{"1":2,"2":1136076},"9":1}}" data-sheets-hyperlinkruns="{"1":402,"2":"https://www.spokesman.com/stories/2021/nov/11/vietnam-veterans-reminisce-heal-as-spokane-rededic/"}{"1":496}">Veterans Day was even more special for our Bernardo Wills Architects design team, as we got to celebrate the redesign and rededication of the Vietnam Veterans Memorial in Riverfront Park. The new design includes a plaza that is wheelchair accessible, new benches, a decorative handrail, and lighting. We are proud to have donated our design services for this important memorial to our local veterans.</span>[nectar_btn size="medium" button_style="regular" button_color_2="Accent-Color" icon_family="none" url="https://www.spokesman.com/stories/2021/nov/11/vietnam-veterans-reminisce-heal-as-spokane-rededic/" text="Read the Spokesman-Review Article"]</p>]]></content:encoded>
"""#
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