当前位置:网站首页>JS common replace () method cases
JS common replace () method cases
2022-07-21 08:42:00 【Upwind elegance】
.replace(/[^\d.]/g, "") // Replace characters other than numbers and dots with blanks
.replace(/^\./g, "") // Verify that the first character is a number and not a dot
.replace(/\.{2,}/g, ".") // When there are multiple points, only the first one is preserved
.replace(".", "$#$") // 1、 Replace the dots of numbers with complex characters $#$
.replace(/\./g, "") // 2、 Clear the dot of the string directly
.replace("$#$", ".") // 3、 Convert complex characters back to dots
.replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3"); // Only two decimals can be entered
边栏推荐
- When business goes out to sea, you should "get your hands dirty" before inspiration appears
- Klocwork部署的安全最佳实践
- After class practice on the second day of safety
- 罗敏成不了董宇辉
- Can the active data guard standby database run query operations or read-only applications?
- VH6501学习系列文章
- CANoe下载地址以及CAN Demo 16的下载与激活,并附录所有CANoe软件版本
- 全网追杀“钱包刺客”
- Hj17 coordinate movement
- 【微信小程序】radio单选框(83/100)
猜你喜欢
Mysql 系列 | 日志模块
Selenium uploads files locally to web pages
How much do you know about the questions often asked by redis in Alibaba's interview?
Rsync combined with inotify to realize real-time file synchronization (I)
抖音爱奇艺宣布合作,长短视频握手和解?
在CANoe中通过Panel面板控制Test Module 运行(高级)
排序与检索(归并/快排/二分)
Lazy to the bone, I am too lazy to write articles in CSDN. I write articles based on selenium simulation
在CANoe中通过Panel面板控制Test Module 运行(初级)
[upload range 17-21] secondary rendering, conditional competition, black and white list bypass
随机推荐
ES6中的Promise
MySQL基础篇(概念、常用指令)
Interprocess communication - shared memory shmat
Embedded development: 10 problems for successful code review
Starting from scratch, C language intensive Part 1: getting to know C language
Control the operation of the test module through the panel in canoe (primary)
Fabric.js 居中元素
HJ13 句子逆序
在CANoe中通过Panel面板控制Test Module 运行(初级)
rsync 结合 inotify 实现文件实时同步(一)
Active Data Guard 备用数据库可以运行查询操作或只读应用程序吗?
After class practice on the second day of safety
Practice upgrade! Chuangyu security trusteeship helps you solve the problem of directional blasting defense
抖音爱奇艺宣布合作,长短视频握手和解?
Several silly built-in functions about relative path / absolute path operation in CAPL script
【开发教程10】疯壳·开源蓝牙智能健康手表-OTA镜像制作及下载技术文档
GCC getting started manual
Cause and effect of memory alignment
[freeswitch development practice] using ESL to connect freeswitch in C language
How much do you know about the questions often asked by redis in Alibaba's interview?