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

http or https

Problem

Write a pattern with an alternation that matches either http or https. Test it on 'https://example' and print the match.

Note which of the two alternatives wins, and why.

Example

The program prints:

「https」

Solution

See the solution

Course navigation

Solution: A size word   |   Solution: http or https