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

后端 未结 7 856
执笔经年
执笔经年 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)

    0 讨论(0)
提交回复
热议问题