How it works...
After the initial setup in steps 1 and 2, we start by creating a tests module in step 3 along with the required dependencies. Step 4 then contains the first test that shows how the regex crate (https://docs.rs/regex/1.2.1/regex/) handles simple parsing of data.
By using the raw string literal syntax, r"I am a raw string", we compile a new Regex instance that we match to date strings. The included character classes are what is commonly used across OSes and languages, which includes support for whitespaces as well as (alpha) numerical characters and raw bytes. Additionally, flags can be placed directly in the expression using a (?flag) notation.
The regular expression in step 4 is composed of three parts: (?P<y>\d{4})-(?P<m>\d{2})-(?P<d>\d{2}) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access