当前位置:网站首页>JS filter / replace sensitive characters
JS filter / replace sensitive characters
2022-07-23 16:05:00 【Smiling Chen sir】
Text box for input content
<input type="text" id="ip1">
Replace button
<button id="bt1"> Replace </button>

Minor case requirements :
// Replace unhealthy ***
// When you click the replace button , Get the user's input , If the access content contains violence , Replace it with ***
// Click event onclick
var bt1=document.getElementById("bt1")
bt1.onclick=function(){
var ip1=document.getElementById("ip1")
var content=ip1.value
// take content Medium sensitive characters Replace with ***
// Replace the string specified in the string
Console console.log(content) Output

content=content.replace(" unhealthy ","***")
// console.log(content)
ip1.value=content
}

That ends here , But it's not completely over .
Thinking questions :
As shown in the figure above : Suppose you enter two... In the text box / Multiple sensitive characters ( unhealthy ), Clicking the replace button will only replace the first unhealthy one with ***, If there is a second / The result of multiple unhealthy clicks on the replace button is zsdcaasc***, In this way , The problem arises , How can we replace all specified strings ? Of course, this question is left for everyone to think .
边栏推荐
- Chapter 4 event handling of quick mastering QML
- MD5 strong collision, secondary decoding,
- ICML 2022 | 稀疏双下降:网络剪枝也能加剧模型过拟合?
- C # close current computer command
- Reproduce various counter attack methods
- [try to hack] SQL injection less7 (into outfile and Boolean blind annotation)
- Unity-笔记-ILRuntime接入
- Self capacitance touch controller for wearable devices it7259q-13, it7259ex-24
- 适用于顺序磁盘访问的1分钟法则
- New infrastructure of enterprise data in the era of digital transformation | love Analysis Report
猜你喜欢

中年危机,35岁被退休,打工人拿什么来抗衡资本家?

现代商业无代码开发平台的治理和网络安全

基于Matlab的SSB信号调制和解调(内附源码)

Google Earth engine -- null value problem in image statistics

【运维】ssh tunneling 依靠ssh的22端口实现访问远程服务器的接口服务
![[attack and defense world web] difficulty Samsung 9 points introductory question (Part 2): shrink, lottery](/img/05/06dd9f071fe18e4a50d767ec51e557.png)
[attack and defense world web] difficulty Samsung 9 points introductory question (Part 2): shrink, lottery

【云原生】docker环境中安装mysql、redis服务

Google Earth Engine——影像统计过程中出现的空值问题

Exclusive interview | open source Summer Star Niu Xuewei

How beautiful can VIM be configured?
随机推荐
一个悄然崛起的国产软件,太强了!
How to become an elegant Hardware Engineer?
Expression du suffixe (une question par jour pendant les vacances d'été 4)
Harbor image warehouse
2022最NB的JVM基础到调优笔记,吃透阿里P6小case
Fake XML cookbook of XML xxE vulnerability
3D math - vector
[try to hack] SQL injection less7 (into outfile and Boolean blind annotation)
Redis中 LRU和LFU的淘汰策略区别
Translucenttb recommendations
【Try to Hack】sql注入 Less7 (into outfile和布尔盲注)
Details of task switching
Learning summary of ugly code
Day14 function module
What is the real HTAP? (2) Challenge article
【攻防世界WEB】难度三星9分入门题(下):shrine、lottery
黑马程序员-接口测试-四天学习接口测试-第三天-postman高级用法,newman例集导出导入,常用断言,断言json数据,工作原理,全局,环境变量,时间戳,请求前置脚本,关联,批量执行测试用例
《代码之丑》学习总结
Google Earth Engine——影像统计过程中出现的空值问题
剑指 Offer II 115. 重建序列 : 拓扑排序构造题
