Pardon me for being naive but isnt it a lot easier to just combine regex and
regular find trying to match a substring like this?

hasmax="unknown":
st=refindnocase("<[ ]*cfmodule[^>]*>",whatever,1,"yes");
//grab the tag

if (st.pos[1] GT 0){
    sub=mid(whatever,st.pos[1],st.len[1]);
   if (findnocase("MAXHSIZE",sub) hasmax="Yes";
   else hasmax="No";
}

If find regex invaluable but sometimes combining with a plain old find makes
my life simpler.


----- Original Message -----
From: "Rick Osborne [Mojo]" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, December 04, 2001 10:54 AM
Subject: RE: Regular Expression


> I know it looks nasty, but this is what I came up with:
>
>
<CFMODULE[[:space:]]+[^>]+textline\.cfm[^>[:space:]]*([[:space:]]+[^M][^A=]?
>
[^X=]?[^H=]?[^S=]?[^I=]?[^Z=]?[^E=]?[_[:alnum:]]*=("[^"]*"|[^>[:space:]]*))+
> [[:space:]]*>
>
> I used the following test cases:
>
> <CFMODULE TEMPLATE="textline.cfm" SOMETHING="foo">
> <CFMODULE TEMPLATE="textline.cfm" SOMETHING="foo" MAXHSIZE="bar"
BAZ="QUUX">
> <CFMODULE TEMPLATE="textline.cfm" O=1>
> <CFMODULE textline.cfm MAXHSIZE="bar">
> <CFMODULE TEMPLATE="textline.cfm" A_B_C=123>
> <CFMODULE textline.cfm MAXHSIZE=2>
>
> It correctly found the 3 lines that do *not* have the MAXHSIZE attribute.
>
> HTH,
> -R
>
>
> -----Original Message-----
> From: Harry Klein [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 04, 2001 12:29
> To: CF-Talk
> Subject: RE: Regular Expression
>
>
> Thanks for your help,
>
> i think my explanation was really bad.
> I would use the same code as you, but my problem is that i want to find
> all <cfmodule> tags with no attribute MAXHSIZE.
> The attribute is not deprecated but required.
>
> Sorry for the inconveniance.
>
> Harry
>
> > -----Original Message-----
> > From: Gyrus [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, December 04, 2001 5:10 PM
> > To: CF-Talk
> > Subject: Re: Regular Expression
> >
> >
> > > In plain english: I try to find all <cfmodule> tags. After
> > <cfmodule are
> > > some characters, then textline.cfm then again some characters.
> > > The expression MAXHSIZE should not be found in the part between
> > > textline.cfm to >
> > >
> > > Again: I try to find wrong <cfmodule> calls with a
> > deprecated attribute
> > > (MAXHSIZE).
> >
> > Slightly confusing explanation, but assume you want to match those
> > tags where MAXHSIZE *does* exist, to identify invalid tags. Try
> >
> > <cfmodule [^>]+textline.cfm[^>]+MAXHSIZE[^>]+>
> >
> > Not 100% on this, but seems to work with basic test. The core
> > trick is "[^>]+" (match one or more characters that aren't ">" -
> > keeps the match inside the tag bounds.
> >
> > hth,
> >
> > - Gyrus
> >
> >
> >
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to