Course of Raku / Regexes and grammars / Regexes

Anchors

So far a pattern could match anywhere inside a string. An anchor does not match a character at all — instead it asserts a position: the start of the string, the end, or the boundary of a word.

Anchors are what let you say “the string must start with this”, “the whole string must be exactly this”, or “this must be a complete word, not just part of one”.

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. Starts with
  2. The whole string
  3. A whole word

Course navigation

Solution: http or https   |   Start and end of string