in reply to Re: regexp help -- grab almost a whole string
in thread regexp help -- grab almost a whole string

Since your strings are separated, they must be captured in separate buffers and there is no way to join them with just a matching regular expression. If you change the calling program to implement the join solution I suggested above, it will not break existing behavior, except that failed matches will store a null string ("") in $circuit_id in place of an undef (both of which still evaluate false). If you cannot change the calling program, then I see no solution.

$REGEXP = get_regexp($ip); $circuit_id = join q{}, $if_descr =~ $REGEXP;