regex - 正则表达式匹配带和不带逗号的数字和小数
问题描述
即使有逗号和小数,我也想匹配数字/小数。例如,我希望它能够匹配一个句子。数字可以在句子的中间、开头或结尾:
the number is 1000 today
the number is 1000.00 today
the number is 1000.142 today
the number is 1000.30 today
the number is 1000.200 today
the number is 1,000 today
the number is 1,000.00 today
the number is 1,000.142 today
the number is 1,000.30 today
the number is 1,000.200 today
我已经尝试过^\d*\.?\d+$
,但似乎没有工作
解决方案
推荐阅读
- delphi - 样式化页面控件上“翻转”到 RTL 的标题
- c++ - 使用复制算法从向量复制到集合
- aeron - Aeron 发布突然停止消息传输
- r - 如何合并R中的重复行?
- confluence - 如何创建一个可共享的链接,将同事引导到 Confluence 页面的特定部分?
- android - AlarmManager:未设置/触发新警报
- amazon-web-services - AWS 分区 Hudi
- node.js - 如何从订阅表中获取最新的一条记录以及来自用户表中的所有记录,并在 sequelize 和 PostgreSQL 中使用左连接
- iframe - 在 MS Teams 会议阶段应用程序中使用 MediaRecorder
- python - 有没有办法使用 python 在 Twitter 上自动发布视频?