如何在PERL中查找和更改十六进制值

[英]how to find and change hexadecimal value in PERL


I want to find x0027; this and change to x2019; hexadecimal value in a string;

我想找到x0027;将其改为x2019;字符串中的十六进制值;

I tried :

我试着:

$string =~s/\x{0027}/\x{2019}/g;

but not working

但是不工作

Kindly anyone give some suggestion to solve this

请给我一些建议来解决这个问题。

Thanks

谢谢

2 个解决方案

#1


2  

No need of \ or { } brackets.

不需要\或{}括号。

$string =~ s/x0027/x2019/g;

#2


1  

Remove the curly brackets:

把花括号:

$string =~s/\x0027/\x2019/g;

or if there're present in the original string, escape them:

或者如果原始字符串中有,转义它们:

$string =~s/\x\{0027\}/\x\{2019\}/g;
智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2014/05/14/ce0a98bff41b04c1bddf72e2892e88cc.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告