Use search instead of match to search entire string, not just the beginn...

...ing.

Clean up string slicing.