In cf5:  
newstring = rereplace(string, "[^(]*(\(.*\)).*", "\1");

Note that this will return the entire string if there is no parentheses.
You could do it in two steps to avoid that

newstring = "";
stTmp = REFind("\(.*\)",string,1,true);
if(stTmp.pos[1]) newstring = Mid(string,stTmp.pos[1],stTmp.len[1]);

> -----Original Message-----
> From: Ben Doom [mailto:[EMAIL PROTECTED]
> Sent: maandag 19 april 2004 22:41
> To: CF-Talk
> Subject: Re: Odd RegEx question.
>
> If CFMX:
>
> newstring = rereplace(string, ".*?(\(.*\)).*", "\1");
>
> If CF5, I'll ... uh ... thing of something else.  :-)
>
> Caveats:  untested, off the top of my head, YMMV
>
> --Ben Doom
>
> Jeff Waris wrote:
>
> > I need some pointing in the right direction. I am guessing
> this is a
> > rereplace Regex situation.  How would you do this
> >
> >
> > Here is my string
> >
> >
> > sometext(1(2)more text
> >
> >
> > I need to strip everything up to the first ( and strip everything
> > after the last )
> >
> >
> > The string I'd like to end up with would be (1(2)
> >
> >
> > Any help would be appreciated...
> >
> > Thanks,
> > Jeff
> >
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to