in reply to regular expression help

Assuming I understand your spec, the solution to your issue would appear to be quantifiers, specifically '?' which matches 0 or 1 occurrences of a patten, combined with the extended pattern '(?:...)', which will allow grouping without capturing. For your provided examples, this works for me:

$str =~ /(?:<\*\d+>)?([^<]+)<(\d+):(\d+)>,<\*\d+>([^<]+)<(\d+):(\d+)>/