in reply to get some part of the string using regex

If you want a non-greedy dot-star, you need to replace (.*)? with (.*?).

Maybe you should even consider something like \|([^|]*)\| to be sure you can't cross the boundary of the pipes (|).


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

Replies are listed 'Best First'.
Re: Re: get some part of the string using regex
by gdnew (Acolyte) on May 17, 2002 at 10:08 UTC
    Thanks...
    You save me...