Regular Expressions 101

Community Patterns

Select any 3 first words with "space" included between the words

0

Regular Expression
PCRE (PHP <7.3)

/
(^([\S]+)([ ])([\S]+)([ ])([\w\d]+)|^(.*)|^(.*)(.*))
/
gm

Description

This regex will find the first 3 words in every row, including any non-whitespace characters and also finds the words if the row has only 1 or 2 words

Submitted by ZoltanBiro - 6 years ago