# Swift Regex Tutorial: Getting Started | Kodeco

**URL:** <https://forums.kodeco.com/t/swift-regex-tutorial-getting-started-kodeco/184612>\
**Category:** 🎓 Courses & Articles\
**Created:** [March 2, 2023, 5:20am UTC](https://forums.kodeco.com/t/swift-regex-tutorial-getting-started-kodeco/184612 "2023-03-02T05:20:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehabamer](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ehabamer/32/109011_2.png) [@ehabamer](https://forums.kodeco.com/u/ehabamer)\
**Post date:** [March 2, 2023, 5:20am UTC](https://forums.kodeco.com/t/swift-regex-tutorial-getting-started-kodeco/184612/1 "2023-03-02T05:20:06Z")

</div>

Master the pattern-matching superpowers of Swift Regex. Learn to write regular expressions that are easy to understand, work with captures and try out RegexBuilder, all while making a Marvel Movies list app!

* * *
This is a companion discussion topic for the original entry at [https://www.kodeco.com/36182126-swift-regex-tutorial-getting-started](https://www.kodeco.com/36182126-swift-regex-tutorial-getting-started)

---

<div class="post-metadata">

**Author:** ![csantavy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/csantavy/32/102075_2.png) [@csantavy](https://forums.kodeco.com/u/csantavy)\
**Post date:** [May 17, 2023, 8:25pm UTC](https://forums.kodeco.com/t/swift-regex-tutorial-getting-started-kodeco/184612/2 "2023-05-17T20:25:15Z")

</div>

Ran the app before making any changes and it crashed immediately after the orange-K splash screen loaded

---

<div class="post-metadata">

**Author:** ![gdelarosa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gdelarosa/32/109063_2.png) [@gdelarosa](https://forums.kodeco.com/u/gdelarosa)\
**Post date:** [June 22, 2023, 9:43pm UTC](https://forums.kodeco.com/t/swift-regex-tutorial-getting-started-kodeco/184612/3 "2023-06-22T21:43:59Z")

</div>

Feedback given by @wtj123… “in the MarvelMovies file, there are 49 records. However, the result of the statement: let matches = content.matches(of: recordMatcher) in the class ProductionsDataProvider only has 39 matches. Can you explain the difference between them?”

---

<div class="post-metadata">

**Author:** ![ehabamer](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ehabamer/32/109011_2.png) [@ehabamer](https://forums.kodeco.com/u/ehabamer)\
**Post date:** [June 24, 2023, 8:30am UTC](https://forums.kodeco.com/t/swift-regex-tutorial-getting-started-kodeco/184612/4 "2023-06-24T08:30:08Z")

</div>

Hello @gdelarosa,  
This is actually a bug in the project that we missed ☹

The rows that were missed are the ones with `-` for the IMDB rating field. The reference types specified for the URL and the rating field are not set as optionals. When the transform in the TryCatch finds a nil the value can’t be bound so the who record is skipped.  
By changing the two references to be optionals, the count for the matches is properly 49 and the missing records are showing.

```auto
let urlFieldRef = Reference(URL?.self)
let imdbRatingFieldRef = Reference(Float?.self)

```

---

<div class="post-metadata">

**Author:** ![gdelarosa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gdelarosa/32/109063_2.png) [@gdelarosa](https://forums.kodeco.com/u/gdelarosa)\
**Post date:** [September 1, 2023, 12:30am UTC](https://forums.kodeco.com/t/swift-regex-tutorial-getting-started-kodeco/184612/5 "2023-09-01T00:30:22Z")

</div>

Thanks for the response @ehabamer! I appreciate it. 😄
