Which regular expression will correspond to 4 digits, a period, then one and only one value?

I need a regex (Java) that will match:

XXXX.X

Where X is any number, only one number after the decimal point.

+3
source share
2 answers

Try ^\d{4}\.\d$it if you want the whole line to match, delete ^and / or $if you want to find matches in the larger line.

. . \d+ \d{4} , \d* ( ".5" \d*\.\d > ).

+9

4 ,

"/(^([0-9]{4})[.]([0-9]{1})$)/"

: 1234.4

, , .

"/(^([0-9]{0,})[.]([0-9]{1})$)/"

: 1234.4
  45.8
  +589745324744,7

0

Source: https://habr.com/ru/post/1781696/


All Articles