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(Document,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]

Reply via email to