开发者

javascript pattern replacement using backreference is not working

开发者 https://www.devze.com 2023-01-18 17:46 出处:网络
string.replace(/([\\开发者_如何学Pythont])/g,\"\\\\$1\") is working fine where string.replace(/([\\n])/g,\"\\\\$1\")
string.replace(/([\开发者_如何学Pythont])/g,"\\$1")

is working fine where

string.replace(/([\n])/g,"\\$1")

is not working!!!

any idea please???

N.B.

string.replace(/\n/g,"\\\n")

is also working fine


Use a script to capture the enter keypress event and replace it with '\' prior to submission.

0

精彩评论

暂无评论...
验证码 换一张
取 消