This is an odd case to use a regex for, actually (it kind of demonstrates a lack of understanding of what a regex is good for).
That being said, though, this:
/(?=.*a)(?=.*e)(?=.*i)(?=.*o)(?=.*u)/i
should do you pretty easily. Granted, it makes use of positive look-ahead which isn't strictly speaking "regular". The basic description of the regex is: there exists a place in the string (the beginning of the string, for example), after which exists an "a" AND after which exists an "e", etc.
To do this with a true regular expression (and hence without lookahead assertions), you'd want to do it by essentially creating a list of all 5-factorial permutations of aeiou, and, over these permutations like so (written out kind of long-hand so that the idea should be transparent):
my @regex_pieces = ();
foreach my $permutation (@permutations) {
my @vowels = split //, $permutation;
push @regex_pieces, join(".*", @vowels);
}
my $regex = qr/@{[join("|", @regex_pieces)]}/i;
------------
:Wq
Not an editor command: Wq
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.