anand kumar wrote:
> Hi all,

Hello,

> I have the following problem in the following regex replace.
> 
> $line=~s!\b($name)\b!<au>$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)!<au>$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!<au>$1!g;



John
-- 
use Perl;
program
fulfillment

-- 
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