Modify regexp to match only namespace or classes with params

Modify the way to check if we have a namespace or classes to keep the
good url