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
Post a Comment