Course of Raku / Regexes and grammars / Regexes / Quantifiers / Exercises

A frugal match

Problem

The string 'say "hi" and "bye"' contains two quoted pieces. Write a pattern that matches only the first quoted piece — from the first " to the nearest " — using a frugal quantifier. Print the match.

Example

The program prints:

「"hi"」

Solution

See the solution

Course navigation

Solution: Two to four digits   |   Solution: A frugal match