Regex fix to avoid matching a trailing slash.