Test, validate and match regular expressions
Matches each line from its start and captures the first 1 to 12 words, where each word is one or more word characters (\w+) optionally followed by a single whitespace. The trailing .* consumes the remainder of the line so only the leading words are kept in the capture group. With the global (g) and multiline (m) flags, it repeats this extraction for every line in a block of text, making it ideal for grabbing line previews, titles, or the first N words per line.