in reply to Need a regex to match C-style function arg list

Given the samples supplied, this does the trick. If your expressions can contain spaces, be split across lines or contain nested concats, then it will need further work.

#! perl -slw use strict; my $re_term = qr[[^,)]+?]; my $re_func = qr[\w+\($re_term,$re_term\)]; my $re_concat = qr[concat\((?:($re_func),($re_term|$re_func))\)]; while(<DATA>) { s[^$re_concat$][$1 & $2]; print; } __DATA__ concat(int2str(count,1),result) concat(bit2str(count,'10'B),result) concat(int2str(count,1),bit2str(count,'10'B))

Gives

c:\test>249976 int2str(count,1) & result bit2str(count,'10'B) & result int2str(count,1) & bit2str(count,'10'B)

Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.