Test, validate and match regular expressions
This regex captures two sequences of word characters (letters, digits, underscores) separated by a single whitespace character, storing each word in its own capture group. With the global and multiline flags enabled, it scans every line of the input to find all such word pairs. A common use case is converting space-separated words into snake_case by replacing matches with something like $1_$2. Note that since \w* can match empty strings, the pattern will also match bare whitespace between non-word characters.