I am trying to match the first word in a string with RegEx.
I know how to match the 1st word if the 1st character string is a word, but the problem is when my line starts; eg.
^([\w\-]+)
Works with
This is my sentence.
but not with
; This is my sentence
My goal is to combine the 1st word
This
No matter what character before.
Thank.
Miloš source
share