SparkyGuy <sparkyguy@[EMAIL PROTECTED]
> wrote:
> > [Ii].*[Nn].*[Tt].*[Uu].*[Oo].*[Nn]
>
> It turns out that this does work to find terms with all these letters in
this
> order even if there are other characters interspersed between them. Such
as:
>
> intuition
> in3t5u7ition
> in tuitio9n
> inBBtuCCon
>
> Now I want to find terms that have all these characters in any order.
Such
> as:
>
> noiiitunt
> tn8no9uitii
> otAAnuiBiit
> unt ioitni
To clarify: do you want at least one each of "I", "T", "U" and "O", and
at least two "N"s, in any order and mixed with any other characters (or
more of the same ones), ignoring case?
Tricky. You can't do that with a simple regular expression, or even a
Perl-compatible regular expression.
It would best done in parallel, testing the string against five
different regular expressions:
[Ii]
[Nn].*[Nn]
[Tt]
[Uu]
[Oo]
The string has to match all of these to pass.
If you really don't need two "N"s then you can simplify the second test
to be like the others. If you want a certain number of each letter, but
in any position, then use the same general syntax as the second line.
> I guess this has something to do with the ^ and $ parsing metasymbols
but I'm
> not knowledgeable enough on this topic to know how, exactly.
Those just mean "start of string" and "end of string" respectively. For
example, if you want to only match a string which starts with "I" or "i"
then your regular expression is "^[Ii]".
--
David Empson
dempson@[EMAIL PROTECTED]


|