> -----Original Message----- > From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]] > Subject: re:Regexp needed > > > hi, i have this: > my ($Path) = $MountsPath =~ /(.+?)cygwin/; > but I wanted to get rid of the "/". > because $MountsPath could be c:/cygwin or c:/xyz/cygwin or > c:/xyz/zyx/cygwin and > i wanted $Path = c: or c:/xyz or c:/xyz/zyx . > And now $Path= c:/ or c:/xyz or c:/xyz/zyx. > How can I do ? > thanks.
Just add the "/" to your match outside the grouping, like so: my ($Path) = $MountsPath =~ /(.+?)\/cygwin/; Hope this helps... Jason CONFIDENTIALITY NOTICE: ************************************************************************ The information contained in this ELECTRONIC MAIL transmission is confidential. It may also be privileged work product or proprietary information. This information is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution [other than to the addressee(s)], copying or taking of any action because of this information is strictly prohibited. ************************************************************************