Hacker
Hacker

Reputation: 7906

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 ?

Upvotes: 3

Views: 114

Answers (1)

codaddict
codaddict

Reputation: 454960

You can try:

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

Upvotes: 2

Related Questions