Challenge 2: A Second Reference Format — Possible Solution ==================================================================== use strict; use warnings; use feature 'say'; my $eml_body = "Reference Number: JO-2601-11029"; (my $plain_body = $eml_body) =~ s/<[^>]+>//g; if ($plain_body =~ /Reference(?: Number)?:\s*(JO-\d+-\d+)/) { my $job_ref = $1; say "Found: $job_ref"; } Output: Found: JO-2601-11029 WHY THIS WORKS AS AN ANSWER ------------------------------ (my $plain_body = $eml_body) =~ s/<[^>]+>//g; reuses the chapter's own strip-first approach exactly, unchanged — it doesn't matter that this example uses tags instead of , since s/<[^>]+>//g matches ANY HTML tag generically (any characters between < and >), exactly the chapter's own point that this approach avoids needing to guess which specific tag might appear. The label text here is "Reference Number" rather than "Job Reference" — a genuinely different wording than the chapter's own example. The pattern is adjusted to Reference(?: Number)? to match this challenge's specific label, reusing the chapter's own (?: ...)? non-capturing-optional-group technique, just moved to make "Number" optional after "Reference" instead of after "Job Reference". \s*(JO-\d+-\d+) is reused completely unchanged from the chapter's own pattern — the same requirement of one-or-more digits in each group, correctly matching "2601" and "11029" here exactly as it matched "2405" and "98673" in the chapter's own worked example, proving the capture-group portion of the pattern generalizes across different label wording without needing any changes itself.