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 4 of 16 Topic 986 of 1040
Post > Topic >>

Re: Help with RegEx?

by SM Ryan <wyrmwif@[EMAIL PROTECTED] > Jan 6, 2008 at 01:43 AM

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. 
# 
# I tried 
# 
#      [Ii][Nn][Tt][Uu][Oo][Nn]
# 
# and
# 
#      [Ii].*[Nn].*[Tt].*[Uu].*[Oo].*[Nn]
# 
# No joy. 

The software really isn't intended to be used this way. It would
be simpler to conjoin a number of searches. Assuming an interface
like
  numberofmatches = regexp(pattern,string)
you can do something like
  regexp("[Ii]",string)==1
  && regexp("[Nn]",string)==2
  && regexp("[Tt]",string)==1
  && regexp("[Uu]",string)==1
  && regexp("[Oo]",string)==1

Some interfaces also allow a flag to ignore character case.
  regexpnocase("i",string)==1
  && regexpnocase("n",string)==2
  && regexpnocase("t",string)==1
  && regexpnocase("u",string)==1
  && regexpnocase("o",string)==1

To do this in a single RE, you have to use all 120 permutations,
  [^IiNnTtUuOoNn]*[Ii][^IiNnTtUuOoNn]*[Nn][^IiNnTtUuOoNn]*[Tt]...
  |[^IiNnTtUuOoNn]*[Ii][^IiNnTtUuOoNn]*[Uo][^IiNnTtUuOoNn]*[Nn]...
  |...

--
SM Ryan http://www.rawbw.com/~wyrmwif/
GERBILS
GERBILS
GERBILS
 




 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 10:04:21 CST 2008.