开发者

In perl how do I get all matching result /g?

$string =开发者_开发百科~ /(pattern)/g;

I know I can get the matching result in $1,but how can I get all (/g) and push each result into an array?


Is this what you mean?

$string = 'patternpattern';
@matches_array = $string =~ /(pattern)/g;
print "@matches_array";

That will produce the following output:

pattern pattern
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜