How can I extract the nth occurrence of a match in a Perl regex?

后端 未结 7 878
执笔经年
执笔经年 2020-12-22 01:32

Is it possible to extract the nth match in a string of single-quoted words?

use strict;
use warnings;

my $string1 = \"\'I want to\' \'ex         


        
7条回答
  •  余生分开走
    2020-12-22 02:26

    See this question: How do I save matched parts of a regex in Perl? and this answer (the /g switch is the trick)

提交回复
热议问题