Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How many groups in a regex?

Status
Not open for further replies.

grimbys

Programmer
Dec 19, 2002
34
0
0
ES
Hi again, I need a copy of $1..$last after a $var =~ /$er/ is done.

Is there any var that says how many groups are there at last expression evaluate?

For example, I'd like:

$var =~ /$er/;
# $n_groups = n_match_parents ($er)
map { $groups{$_} = ${$_}} 0 .. $n_groups;

How I can get $n_groups?
Thank you very much.
 
Oh, sorry, I solved it:

while (defined ${$i})
{
group[$i] = ${$i};
$i ++;
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top