开发者

perl - regular expression - match case

Hi I have some file that looks like this:

some row
/folder1/folder2/folder3/folder4/f开发者_开发知识库older5  *.kuku.* noku
/folder1/folder2/folder3/folder4/folder5  *.kuku noku 
another row
another row

if first line is absent I need to add it, if second line is absent I need to add only second line

I wrote regular expressions , but they are not really works:

if ($line =~ /(\*\.kuku\.\*\b)/) {do something}

if ($line =~ /(\*\.kuku\b)/) {do something else}

Any idea? Thanks


\b only matches on word boundaries. \*\.kuku\.\*\b will never match because * is not a word character.

You could change it to \s so you match a whitespace. \*\.kuku\.\*\s

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜