Reputation: 89
I've tried this
(?!\sa-zA-Z){4,}\s{1,}
EDIT: I would like this result : aa aa..., aaa a..., a aaa..., aaaa ...
Upvotes: 3
Views: 159
Reputation: 163527
You can use
\b[a-zA-Z](?=[a-zA-Z ]{3})[a-zA-Z]* +[a-zA-Z]*
Explanation
\b
A word boundary to prevent a partial word match[a-zA-Z]
Match a single char a-zA-Z(?=[a-zA-Z ]{3})
Positive lookahead, assert 3 of the listed chars in the character class to the right of the current position[a-zA-Z]* +[a-zA-Z]*
Match optional chars a-zA-Z, then match 1+ spaces space and again optional chars a-zA-ZSee a regex demo.
Upvotes: 3