✅ – ✅ – dmikester1 – 15-15 Jul 27
Hoping there are some regex gurus in here. I have an input where I simply need to allow numbers with a possible decimal. I did a lot of googling and stack overflowing.
3 Replies
I found this regex:
const re = /^\d+(\.\d{1,2})?$/;
so my entire function looks like this:
I learned that i can paste in an entire number with a decimal just fine using that. But I cannot type the characters one by one.
I assume that is because 12.
does not match the regex.
That makes sense, thank you.This question has an answer! Thank you for helping 😄
If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1134141929949515817
This question has an answer! Thank you for helping 😄
If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1134141929949515817
This thread hasn’t had any activity in 36 hours, so it’s now locked.
Threads are closed automatically after 36 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1134141929949515817