extract the first word from a string – regex August 14, 2023 by Tarik It’s pretty easy, just include allowed characters in brackets: ^([\w\-]+)