Made the filename parsing regex-based.

Signed-off-by: Difegue <sugoi@cock.li>