Perl 单词边界
发布时间:2020-12-15 23:50:29 所属栏目:大数据 来源:网络整理
导读:单词边界:b匹配单词边界,就是位于单词(w)和非单词字符(W)之间的零宽度的地方。就是单词前后必须跟非单词字符[oracle@jhoa big]$ cat 11.pl #$var = "The Great Fred";$var = "Fred erick the Great";if ($var =~/bFredb/){print "$varn"};[oracle@jhoa
单词边界: b匹配单词边界,就是位于单词(w)和非单词字符(W)之间的零宽度的地方。 就是单词前后必须跟非单词字符 [oracle@jhoa big]$ cat 11.pl #$var = "The Great Fred"; $var = "Fred erick the Great"; if ($var =~/bFredb/){print "$varn"}; [oracle@jhoa big]$ perl 11.pl Fred erick the Great [oracle@jhoa big]$ cat 11.pl #$var = "The Great Fred"; $var = "aFred erick the Great"; if ($var =~/bFredb/){print "$varn"}; [oracle@jhoa big]$ perl 11.pl [oracle@jhoa big]$ Fred前面出现单词字符,匹配不上 [oracle@jhoa big]$ cat 11.pl #$var = "The Great Fred"; $var = "Freda erick the Great"; if ($var =~/bFredb/){print "$varn"}; [oracle@jhoa big]$ perl 11.pl [oracle@jhoa big]$ Fred后面出现单词字符匹配不上 [oracle@jhoa big]$ cat 11.pl #$var = "The Great Fred"; $var = "!Fred erick the Great"; if ($var =~/bFredb/){print "$varn"}; [oracle@jhoa big]$ perl 11.pl !Fred erick the Great [oracle@jhoa big]$ 单词前面出现非单词字符,可以匹配 [oracle@jhoa big]$ cat 11.pl #$var = "The Great Fred"; $var = "Fred! erick the Great"; if ($var =~/bFredb/){print "$varn"}; [oracle@jhoa big]$ perl 11.pl Fred! erick the Great [oracle@jhoa big]$ 单词后面出现非单词字符,可以匹配 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |