in reply to Perl Regular Expressions

add the /m modifier so that ^ matches the beginning of a "line" and not the beginning of your whole string.
if that doesn't help show us more code, e.g. the part where you execute the regex on the string.
for details see perlre