Course of Raku / Regexes and grammars / Regexes / Adverbs / Case-insensitive matching

Quiz — Ignorecase

What does the following program print? The pattern is upper-case and the text is mixed-case.

say 'Hello' ~~ /:i HELLO/;
1「Hello」
0「HELLO」
0True
0False

The :i adverb turns off the upper/lower-case distinction, and it works in either direction — here the upper-case pattern HELLO matches the mixed-case text. The result is the matched text as it appears in the string, 「Hello」.

Course navigation

Case-insensitive matching   |   Adverb scope