正则乘法 [英] Regex multiplication

查看:69
本文介绍了正则乘法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我问之前环顾了一段时间,但我似乎找到了很多关于使用正则表达式进行电子邮件和货币转换的方法,但仅将数字与设定值相乘没有任何内容.本质上,我有一个货币值字段,可以说:127.25GBP 需要转换为 165.42(只有两个小数点,没有货币指标)可以这样做吗?如果可以,怎么做?

looked around for a while before I asked but I seem to find a lot of how to's on email and currency conversion using regex but nothing on just multiplying a number with a set value. Essentially, I have a currency value field of lets say: 127.25GBP which needs to be converted to 165.42 (only two decimal points and no currency indicator) Can that be done and if yes how?

非常感谢您的帮助!

谢谢

删除

推荐答案

正则表达式用于文本匹配,而不是算术.一些接受正则表达式的工具可用于执行算术运算,例如 Perl 和 Awk.

Regular expressions are intended for text-matching, not arithmetics. Some of the tools that accept regexes can be used to perform arithmetics, like Perl and Awk for instance.

这篇关于正则乘法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆