[英]Replace all digits except the last four using regex.
I am using regex in javascript and want to replace all the digits in a number except the last four with '#'
. 我在javascript中使用正则表达式,并希望用
'#'
替换除了最后四个之外的数字中的所有数字。 I have figured out how to replace all the digits with '#'
, what do I do to not replace the last four? 我已经想出如何用
'#'
替换所有数字,我怎么做才能不替换最后四个? Here is my code so far. 到目前为止,这是我的代码。
return cc.replace(/[0-9]/g, "#")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.