develooper Front page | perl.perl6.users | Postings from May 2018

regex and metacharacters

From:
ToddAndMargo
Date:
May 22, 2018 04:06
Subject:
regex and metacharacters
Message ID:
71f893cf-8ec1-ed7f-cee2-b1fd11bcb828@zoho.com
Hi All,

With the help of the guys on the chat line, I learned
something new.  How do deal with metacharacter(s) in
a regex.

To match a metacharacter: "<" and "?" in this example:
     $ p6 'if "</span xxx" ~~ m| ("</"span) |   {say "y"}else{say "n"};'
     y

     $ p6 'if "</spmm xxx" ~~ m| ("</"span) |   {say "y"}else{say "n"};'
     n

-T



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About