In article <0001HW.C3A53B750065FE02B019F94F@[EMAIL PROTECTED]
>,
SparkyGuy <sparkyguy@[EMAIL PROTECTED]
> wrote:
> I want to build a regular expression that will find certain characters
in a
> field.
>
> For example:
>
> i,n,t,u,o,n
>
> all need to be present (at least once) for the RegEx interpreter to
label
> this search True. The order is not im****tant, and case should be
ignored.
The 'order is not im****tant' part makes a regular expression a 'less
than the ideal' solution for your problem.
> I tried
>
> [Ii][Nn][Tt][Uu][Oo][Nn]
>
> and
>
> [Ii].*[Nn].*[Tt].*[Uu].*[Oo].*[Nn]
>
> No joy.
>
> Also tried use of ^ and $ but I'm not sure how to implement them, and
whether
> or not they are required.
>
> So basically I'm stumbling around in the dark.
The 'I tried', and 'I am not sure' parts already carried that message,
but it is good to hear that you know that you do not really know what
you are doing.
> But I want to learn. I've viewed several tutorials on-line, but this
> subject is so obtuse to me that it's difficult even getting started.
I guess that you are at the stage where 'every thing looks like a nail,
even your thumb'. Regular expressions are powerful, but not suited for
every job. This is one of those jobs. You can create a regular
expression of this, but it would have to sum up all 360 (that would be
720 if the six letters were different) permutations of the six letters
used, for a regular expression of length around 34 * 360 + 2 * 359.
> Any suggestions would be greatly appreciated.
For me, the #1 rule when building regular expressions is: when your
regular expression does not do what you think it should do, shorten it,
and check (in a simple test program) that the shorter one does what you
think it should do.
In your case, you might want to start with "[Ii].*[Nn]" and work from
there.
<http://www.regular-expressions.info/>
might help you.
If you have access to a Windows machine: have you seen
<http://www.regexbuddy.com/test.html>?
I have not used it myself, but
heard positive comments about it.
> Thanks!
In article <0001HW.C3A5A5B8007EE5D3B019F94F@[EMAIL PROTECTED]
>,
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
That should work on with most, if not all, regular expression libraries.
See for example <http://www.regextester.com/>.
Which one are you using?
> I guess this has something to do with the ^ and $ parsing metasymbols
Why makes you think that?
Reinder


|