Course of Raku / Regexes and grammars / Regexes

Adverbs

An adverb is an option that changes how a regex behaves. You write it as a colon-word at the start of the pattern (or on the m/// operator). Adverbs let you match without regard to letter case, find all the matches instead of just the first, and make spaces in the pattern significant.

This section covers the three you will reach for most often: :i, :g, and :s.

Topics in this section

Practice

Complete the quizzes that cover the contents of this section.

Exercises

This section contains 3 exercises. Examine all the topics of this section before doing the coding practice.

  1. Case-blind match
  2. Count the matches
  3. All the numbers

Course navigation

Solution: Between brackets   |   Case-insensitive matching