简体   繁体   中英

regular expression match php

I need to do a regular expression match in php . the case is that .

2 digits before decimal and 2 digits after decimal.

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})?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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