The syntax of regexes is a small language within Perl 6. As there are many things to express, it uses some characters to convey the meaning. Letters, digits and underscores stand for themselves without any special meaning. These characters can be used as-is, as shown in the following example:
my $name = 'John';
say 'OK' if $name ~~ /John/; # OK
my $id = 534;
say 'OK' if $id ~~ /534/; # OK
If the string inside a regex contains other characters, for example, spaces, you should take care of them. One of the possibilities is to quote the whole string:
my $name = 'Smith Jr.' ;
say 'Junior' if $last-name ~~ /' Jr'/; # Junior
The literal string ' Jr' inside a regex contains a space that will have to be present in the variable $name.
Another alternative is to use a special character, prefixed by a backslash. For...