Improve Loader by using preg_match instead of strspn.

Quick benchmark on this showed that for n=10.000.000 strspn is about 4x slower than preg_match.
preg_match: 7.519548
strspn: 30.688972