SyntaxFix
Write A Post
Hire A Developer
Questions
Use this regex
^\w+
\w+ matches 1 to many characters.
\w+
\w is similar to [a-zA-Z0-9_]
\w
[a-zA-Z0-9_]
^ depicts the start of a string
^
About Your Regex
Your regex (.*)?[ ] should be ^(.*?)[ ] or ^(.*?)(?=[ ]) if you don't want the space
(.*)?[ ]
^(.*?)[ ]
^(.*?)(?=[ ])