Okay, you *might* have a problem. If not, then ignore this, but consider
this email if the ReFindList brings back odd results:

This updated function has a third optional parameter. This third parameter
allows you to change all occurance of a single string with a  single
character. This helps searching in regexp sometimes. You won't need to worry
about this unless my first solution does not work:

e.g. ReFindList(documentstring,'<center>(.*?)</center>','</center>') - the
last parameter is temporarily converted to a "§". Any character could be
used provided it does not appear in the document.

Of course, if your <center> tags are nested, you'll be in trouble.

==========================================
function ReFindList(Document,SearchString) {
                var ComponentList='';
                var thisPosition=1;
                var exitloop='false';
                if (ArrayLen(Arguments) gte 3) {
                        if (Arguments[3] neq '') {
                                Document=ReReplaceNoCase(Document,
Arguments[3], '§', 'ALL');
                        }
                }
                while (exitloop eq 'false') {
        
st=refindnocase(SearchString,Document,thisPosition,'TRUE');
                        if (st.pos[1] neq 0) {
        
ComponentList=ListAppend(ComponentList,rereplacenocase(Mid(Document,st.pos[1
],st.len[1]),SearchString,'\1','ALL'));
                                thisPosition=st.pos[1]+1;
                        }
                        else {
                                exitloop='true';
                        }
                }
                if (ArrayLen(Arguments) gte 3) {
                        if (Arguments[3] neq '') {
                                ComponentList=ReReplaceNoCase(ComponentList,
'§', Arguments[3], 'ALL');
                        }
                }
                return ComponentList;
        }
==========================================

Paolo

> -----Original Message-----
> From: Stephen Pope [mailto:[EMAIL PROTECTED]
> Sent: 22 October 2003 11:11
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] RegEx Fun Fun Fun
> 
> 
> Yeah .. it might have no tags or it might have a whole freak 
> load of em .. hence the greedy regExp. Im scraping thousands 
> of old HTML files of an old site for very quick rebranding .. 
> horrid job :¬/
> 
> Thanks anyway :¬)
> 
> -----Original Message-----
> From: Paolo Piponi [mailto:[EMAIL PROTECTED] 
> Sent: 22 October 2003 11:06
> To: '[EMAIL PROTECTED]'
> Subject: RE: [ cf-dev ] RegEx Fun Fun Fun
> 
> I think you'll be better with "<center>[^<]*</center>" unless 
> you have tags
> within the <center> tag.
> 
> Paolo
> 
> > -----Original Message-----
> > From: Stephen Pope [mailto:[EMAIL PROTECTED]
> > Sent: 22 October 2003 10:58
> > To: [EMAIL PROTECTED]
> > Subject: RE: [ cf-dev ] RegEx Fun Fun Fun
> > 
> > 
> > Ooh thanks for that .. *adds to code store* :¬)
> > 
> > Think I just worked it out though ..
> > 
> > ".*<center>(.*?)</center>" .. that seems to be the puppy !
> > 
> > Apologies for my poor and very greedy regexp writing :¬)
> > 
> > Stephen
> > 
> > -----Original Message-----
> > From: Paolo Piponi [mailto:[EMAIL PROTECTED] 
> > Sent: 22 October 2003 10:54
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: [ cf-dev ] RegEx Fun Fun Fun
> > 
> > There might be a more elegant way, but I have this function:
> > 
> > ==================================
> >     function ReFindList(Document,SearchString) {
> >             var ComponentList='';
> >             var thisPosition=1;
> >             var exitloop='false';
> >             while (exitloop eq 'false') {
> >     
> > st=refindnocase(SearchString,Document,thisPosition,'TRUE');
> >                     if (st.pos[1] neq 0) {
> >     
> > ComponentList=ListAppend(ComponentList,rereplacenocase(Mid(Doc
> ument,st.pos[1
> > ],st.len[1]),SearchString,'\1','ALL'));
> >                             thisPosition=st.pos[1]+1;
> >                     }
> >                     else {
> >                             exitloop='true';
> >                     }
> >             }
> >             return ComponentList;
> >     }
> > ==================================
> > 
> > It returns a list of all occurances of the search string. 
> Just use the
> > resulting list to find the first and last.
> > 
> > Paolo
> > 
> > > -----Original Message-----
> > > From: Stephen Pope [mailto:[EMAIL PROTECTED]
> > > Sent: 22 October 2003 10:37
> > > To: [EMAIL PROTECTED]
> > > Subject: [ cf-dev ] RegEx Fun Fun Fun
> > > 
> > > 
> > > Lo all,
> > > 
> > >  
> > > 
> > > Having some probs with a regexp wondered if anyone can help :¬)
> > > 
> > >  
> > > 
> > > Heres the test ..
> > > 
> > >  
> > > 
> > > <CENTEr><b>Yay! You found it !</b></CENTEr>
> > > 
> > > <cENTER>Ignore me I'm the middle ground !</cENTER>
> > > 
> > > <CENTER>Yay! You found the last One !</CENTER>
> > > 
> > >  
> > > 
> > > From this little example I want to return the top center tag 
> > > and the bottom center tag.
> > > 
> > >  
> > > 
> > > I've managed to grab the first one with the expression 
> > > "<center>(.*?)</center>" but I'm stuck on grabbing the last 
> > > one in that example.
> > > 
> > >  
> > > 
> > > Can anyone help ?
> > > 
> > >  
> > > 
> > > Regards
> > > 
> > >  
> > > 
> > > Stephen Pope
> > > Web Developer
> > > 
> > > Eduserv Internet
> > > managed hosting and development  
> > > 
> > >   _____  
> > > 
> > > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  
> > > 
> > > tel: +44 (0)1225 474300
> > > fax: +44 (0)1225 474301
> > > http://www.eduserv.org.uk/internet/ 
> > > 
> > >   _____  
> > > 
> > > Eduserv Internet is a service of Eduserv Technologies Ltd 
> > > 
> > >  
> > > 
> > > 
> > 
> > -- 
> > ** Archive: 
> http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > For human help, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > -- 
> > ** Archive: 
> http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > For human help, e-mail: [EMAIL PROTECTED]
> > 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 

--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to