php - regular expressions multiple statements -
i have half problem working. problem is: need match words either 7 letters long , starting st or 9 letters long ending tion. have code works first half of question: st\w{5}\s
. match 7 letter word such 'startin' in example: start startin starting.
however cant seem add second half. (st\w{5}\s)|(tion\w{5})
not work in trying find 'startin' , 'attention' out of: start startin starting attention. thanks.
you'll want word boundaries \b(?:(st\w{5})|(\w{5}tion))\b
Comments
Post a Comment