import re as regex
pattern = regex.compile(r'\w[\w\/\\-]*(\s*[\w\/\\-])*')
print pattern.findall("HELLO-WORLD")
This just prints out ['']
The regex works correctly on an online regex tester. Why is it not matching?
You can use a non-capturing group (i.e. (?:\s*[\w/\\-]), the (?:...) does not form a capturing group and re.findall returns the whole match, not the captured group value(s)):
import re
pattern = re.compile(r'\w[\w/\\-]*(?:\s*[\w/\\-])*')
print(pattern.findall("HELLO-WORLD"))
See the IDEONE demo
Also, note that / symbol does not have to be escaped in a Python regex pattern.
Another point is that there is a PyPi regex module, and that is why I suggest using import re rather than hiding it with as regex.
re.findall contains capturing groups, it will only return the content captured by the groups; not the whole match.
\w[\w/\\-]*(?:\s*[\w/\\-])*. See ideone.com/NIarL0