"John W. Krahn" <[EMAIL PROTECTED]> wrote:    anand kumar wrote:
> Hi all,

Hello,

> I have the following problem in the following regex replace.
> 
> $line=~s!\b($name)\b!$1!g;
> 
> here this regex finds the exact matching of the content in $name and does
> the needed but in some examples the variable $name may contain backslash
> characters like 'gene\l=s\' , in this type of cases the replace string does
> not work so i have removed '\b' on either side and used the following
> 
> $line=~s!(\Q$name\E)!$1!g;
> 
> This works fine but the problem is that the replacement is not done on the
> exact word but also on substrings which is unnecessary.
> 
> if i use both \b\b and \Q\E then the code fails to replace.
> 
> please send suggestions in this regard

$line=~s!\b(\Q$name\E)\b!$1!g;



John
-- 
use Perl;
program
fulfillment
   
  Hi john,
   
       i have tried the above method but the replace ment is done .
  regards
  anand

                                
---------------------------------
 Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.

Reply via email to