regex - how to match whitespace and alphanumeric characters in python -


hey guys im trying match string has space in middle , alphanumeric characters so:

test = django cms 

i have tried matching using follwing pattern:

patter = '\s' 

unfortunately matches whitespace, when match found using search method in re object, returns whitespace, not entire string, how can change pattern returns entire string when finding match ?

import re  test = "this matches" match = re.match('(\w+\s\w+)', test) print match.groups() 

returns

('this matches',) 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -