Use split to hack the string into pieces, then just use the ones you want:
sub pre_nth {
my ($str, $char, $n) = @_;
return join("", (split /(?=$char)/, $str)[0.. $n-1]);
}
print pre_nth("this q is the q of the q which quickly quoth he.",
q => 3);
Update: Oops. Looks like I misread the question slightly (my solution ain't just one regex) but it may still be of some use. For example, this solution scales to when you want to deal with phrases instead of characters.
perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'