Ask Your Question
0

What is the regular expression that will only allow decimal input?

asked 2023-04-29 00:22:47 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-04-29 00:41:02 +0000

djk gravatar image

The regular expression that will only allow decimal input is:

^[0-9]+(.[0-9]+)?$

This expression will allow for any positive or negative decimal number, with or without leading zeros, and can also handle decimal numbers with or without a decimal point.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-04-29 00:22:47 +0000

Seen: 16 times

Last updated: Apr 29 '23