Saju Palayur wrote:
> Hi
> 
> I am trying to do some thing like this, but am getting the wrong
> output. Can somebody tell if my regular expression is wrong or not?
> 
> ---------Perl script---------------------------------------
> $line = "ABCXYZGwcTI\\ABCXYZIntValTI";
> 
> $line=~s/ABCXYZ(.*)TI/Hello$1/g;
        Regex by nature are greedy so you need to tell it not to be greedy. So if you 
try

$line =~ s/ABCXYZ(.+?)TI/Hello$1/g;
        
        You will get the hello's correctly, but not the \'s.  If you want the double 
slash then you should have 4 slash's to get two slashes.  I tried with single qutoes 
and still had problems.  So we  will see how the gurus would handle.

Wags ;)
> print $line;
> ---------Output---------------------------------------
> HelloGwcTI\\ABCXYZIntVal
> ---------Expected Output-------------------------
> HelloGwc\\HelloIntVal
> ----------------------------------------------------------
> Thanks in Adcance
> Saju
> 
> _________________________________________________________________
> Tired of slow downloads and busy signals?  Get a high-speed Internet
> connection! Comparison-shop your local high-speed providers here.
> https://broadband.msn.com



**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to