Should the pattern instead be `[^\s].+|\s+\S.*`? Why do you allow whitespace at the beginning of the title?