regex match first occurrence of a single character

I’ll make this extremely simple

I have a function that comes across a string as such by design: water 'thing one'

I need to split this string by the first space, since there are spaces elsewhere.

I’ve tried many regex expressions like / .*? /, but they can only match two consecutive spaces.

How do I do this?

Thanks in advance.

13 thoughts on “regex match first occurrence of a single character”

Leave a Comment