Course of Raku / Regexes and grammars / Grammars / Creating grammars / Exercises

Parse a hashtag

Problem

Write a grammar that parses a hashtag of the form #tag, where the tag is a run of word characters following a literal #. Use it to parse '#raku' and print the captured tag.

Example

The program prints:

「raku」

Solution

See the solution

Course navigation

Solution: Parse a full name   |   Solution: Parse a hashtag