in reply to Regex question

Apart from the comments that you have already got, you seem to use the "*" quantifier rather indiscriminately. Are you sure you know what it does in a regex?

What you specify as "(?:\s|\n)" is equivalent to a single "\s". "\n" is already included in the set of characters matched by "\s".

Anno

Update: Minor corrections