How can I match a pipe character followed by whitespace and another pipe?

前端 未结 5 1564
春和景丽
春和景丽 2021-01-12 01:14

I am trying to find all matches in a string that begins with | |.

I have tried: if ($line =~ m/^\\\\\\|\\s\\\\\\|/) which didn\'t work. <

5条回答
  •  盖世英雄少女心
    2021-01-12 01:49

    You are escaping the pipe one time too many, effectively escaping the backslash instead.

    print "YES!" if ($line =~ m/^\|\s\|/);
    

提交回复
热议问题