简体   繁体   English

正则表达式匹配php

[英]regular expression match php

I need to do a regular expression match in php . 我需要在php中进行正则表达式匹配。 the case is that . 情况是这样的。

2 digits before decimal and 2 digits after decimal. 十进制前2位数,小数点后2位数。

the problem is that it may and may not have decimal and after decimal digits . 问题是它可能有也可能没有小数和十进制数字。

how do i write a expression for this ? 我该如何为此写一个表达式?

你可以试试:

\d{2}(?:\.\d{2})?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM