regular expression: match any word until first space

前端 未结 8 1129
情话喂你
情话喂你 2020-12-02 06:20

I have the following line:

hshd    household   8/29/2007   LB

I want to match anything that comes before the first space (whitespace). So,

8条回答
  •  感动是毒
    2020-12-02 06:47

    Derived from the answer of @SilentGhost I would use:

    ^([\S]+)
    

    Check out this interactive regexr.com page to see the result and explanation for the suggested solution.

提交回复
热议问题