Course of Raku / Regexes and grammars / Regexes / Matching strings / Exercises / Did it match?

Solution: Did it match?

Here is a possible solution to the task.

Code

say so 'Hello, World' ~~ /World/;

🦋 You can find the source code in the file did-it-match.raku.

Output

True

Comments

  1. A successful match is a true value, but it prints as a match object. The so function turns it into a plain True or False.

Course navigation

Did it match?   |   The matched text