简体   繁体   English

使用javascript解析双引号复制过去的问题

[英]Parse Double quotes copy past issue with javascript

I am coping a string having quotes like this " " after pasting the string which having this double-quote it changing shape and becoming “ ”在粘贴具有双引号的字符串后,我正在处理一个带有像这样的引号的字符串" " ,它会改变形状并变成“ ”

Now I am parsing this string with javascript but getting this double-quote issue because it is not same as a copy it.现在我正在用 javascript 解析这个字符串,但得到这个双引号问题,因为它与它的副本不同。

" " changing “ ” " "变化“ ”

I have tried replacing ASCII of double-quote also but it is not detecting this “ ” double quote我也试过替换双引号的 ASCII,但它没有检测到这个“ ”双引号

'The mechanism of “x” is not the way I want'.replace('\"', '"');

What is needed is to change “ ” in this " " so I can parse it with regular " " double quote需要的是改变这个“ ”中的" "这样我就可以用常规的" "双引号解析它

From an engine perspective, " is not the same as , or . This 'The mechanism of “x” is not the way i want'.replace('\\"', '\\s');从引擎的角度来看, " 。这个'The mechanism of “x” is not the way i want'.replace('\\"', '\\s'); will need to become 'The mechanism of “x” is not the way i want'.replace(/[“”]/g, '"'); .将需要成为'The mechanism of “x” is not the way i want'.replace(/[“”]/g, '"');

As small example of the regex is available here .此处提供了正则表达式的小示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM