you could simplify the regex as ``/^ +/`` and then using ``$matches[0]``