有没有办法从“many”|“'正则表达式“匹配。如何从perl中的多个模式匹配得到许多匹配的模式
这里是我的代码,
#! /usr/bin/perl
@matches = qw(google intel hp qualcomm app);
$keyword = join('|', @matches);
$string = "hello google app";
@founded = ($string =~ /($keyword)/);
print "Founded keyword is:" . join(" ", @founded);
我希望能得到“谷歌和应用程序”,因为这个关键字都在字符串匹配。但是,如何悲伤,只是让“谷歌”
明白了。 Thx这么多 – wbo4958 2013-03-10 09:17:09