regex - Regular expression for selecting single spaced phrases but not whitespace -
i need rather complicated regular expression select words 1 space between them , can include '-' symbol in them, should not select continuous whitespace.
'kenedy john g jr e' 'example' 'd-54' i have tried following regular expression:
\'([\s\w-]+)\' but selects continuous whitespace don't want do.
i want expression select
'kenedy john g jr e' 'example' 'd-54'
perhaps,
\'([\w-]+(?:\s[\w-]+)*)\' ?
edit
if leading/trailing dashes (on word boundaries) not allowed, should read:
/\'(\w+(?:[\s-]\w+)*)\'/
Comments
Post a Comment