I think ToddAndMargo was thinking of perl5 regexes, where [.] is
a good way of matching a literal dot-- though myself, I'm more
inclined to use \.

In Raku, the square brackets just do non-capturing grouping
much like (?: ... } in perl5.  To do a character class, you need
angles around the squares.  This would work to match a single dot:

  <[.]>

In Raku regexes a \. would also work to match a literal dot.
Until I saw JJ Merelo's post, I don't think I realized that
you could quote a meta-character using quotes:  "."

Which means there's some potential confusion if you really need
to match quotes:

    my $str = 'string_632="The chicken says--", voice="high"';

    say
      $str ~~ m:g{ ( " .*? " ) };   # False

    say
      $str ~~ m:g{ ( \" .*? \" ) };  # let's feed another quote: "  to
an emacs syntax highlighting bug
     # 「"The chicken says--"」
     # 0 => 「"The chicken says--"」 「"high"」
     #  0 => 「"high"」)

Reply via email to