Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer > Re: Help with R...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 16 Topic 986 of 1040
Post > Topic >>

Re: Help with RegEx?

by Reinder Verlinde <reinder@[EMAIL PROTECTED] > Jan 6, 2008 at 03:25 PM

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
 




 16 Posts in Topic:
Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-05 23:07:58 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-06 01:43:11 
Re: Help with RegEx?
dempson@[EMAIL PROTECTED]  2008-01-06 15:06:06 
Re: Help with RegEx?
SM Ryan <wyrmwif@[EMAI  2008-01-06 01:43:13 
Re: Help with RegEx?
Reinder Verlinde <rein  2008-01-06 15:25:24 
Re: Help with RegEx?
Paul Floyd <root@[EMAI  2008-01-06 15:25:32 
Re: Help with RegEx?
Ben Artin <macdev@[EMA  2008-01-08 21:27:23 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-09 01:15:16 
Re: Help with RegEx?
dempson@[EMAIL PROTECTED]  2008-01-09 22:57:18 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-09 18:28:01 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-10 10:25:27 
Re: Help with RegEx?
John Whorfin <_@[EMAIL  2008-01-11 07:11:05 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-10 20:58:02 
Re: Help with RegEx?
SparkyGuy <sparkyguy@[  2008-01-10 21:12:07 
Re: Help with RegEx?
dempson@[EMAIL PROTECTED]  2008-01-11 12:03:31 
Re: Help with RegEx?
Sherman Pendley <spamt  2008-01-10 18:20:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 9:41:16 CST 2008.