Hi jgeisler
See, you have used '+' which matches the unknown number of words exactly. But if you want to capture the matched unknown words after text, you have to use another parantheses as shown below.
use strict; use warnings; my $text = 'text'; my $str = 'text some words here'; if ($str =~ /$text \s ((?: (\w+) \s?)+)/x) { print "The words after text are :$1\n"; } prints: The words after text are :some words here
Prasad
In reply to Re: Getting + and * to generate multiple captures
by prasadbabu
in thread Getting + and * to generate multiple captures
by jgeisler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |