python - Regex - how to capture many words -


i have simple regex question:

given string "test-class" regex should use ['test','class'] (in python context)

you don't need regex; use str.split():

>>> 'test-class'.split('-') ['test', 'class'] 

a regex solution still split:

>>> import re >>> re.split(r'-', 'test-class') ['test', 'class'] 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -