首页 > 解决方案 > 如何用普通数字替换大写数字?

问题描述

我的文字中有以下符号:

V is 100 m³, and square is 12 m²

我需要将这些符号替换为正常一次:

V is 100 m3, and square is 12 m2

我坚持使用以下正则表达式:

var result = text.repalce(/³/, '3').replace(/²/, '2');

它工作得很好,但我想要一个通用的正则表达式,它可以覆盖所有大写的数字(1、2、3、4 ....)。

请帮帮我。

标签: javascriptregex

解决方案


推荐阅读