If you plan to match words as chunks of text only consisting of English letters you may use a regex like
(?=w*?a)(?=w*?e)(?=w*?i)(?=w*?o)(?=w*?u)[a-zA-Z]+
See the regex demo
To support languages other than English, you may replace [a-zA-Z]+
with [^Wd_]+
.
If a "word" you want to match is a chunk of non-whitespace chars you may use
(?<!S)(?=S*?a)(?=S*?e)(?=S*?i)(?=S*?o)(?=S*?u)S+
See this regex demo.
Define these patterns in Python using raw string literals, e.g.:
rx_AllVowelWords = r'(?=w*?a)(?=w*?e)(?=w*?i)(?=w*?o)(?=w*?u)[a-zA-Z]+'
Details
(?=w*?a)(?=w*?e)(?=w*?i)(?=w*?o)(?=w*?u)[a-zA-Z]+
:
- a word boundary, here, a starting word boundary
(?=w*?a)(?=w*?e)(?=w*?i)(?=w*?o)(?=w*?u)
- a sequence of positive lookaheads that are triggered right after the word boundary position is detected, and require the presence of a
, e
, i
, o
and u
after any 0+ word chars (letters, digits, underscores - you may replace w*?
with [^Wd_]*?
to only check letters)
[a-zA-Z]+
- 1 or more ASCII letters (replace with [^Wd_]+
to match all letters)
- a word boundary, here, a trailing word boundary
The second pattern details:
(?<!S)(?=S*?a)(?=S*?e)(?=S*?i)(?=S*?o)(?=S*?u)S+
:
(?<!S)
- a position at the start of the string or after a whitespace
(?=S*?a)(?=S*?e)(?=S*?i)(?=S*?o)(?=S*?u)
- all English vowels must be present - in any order - after any 0+ chars other than whitespace
S+
- 1+ non-whitespace chars.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…