0

Add dollar Sign ($) to textbox constraint.

asked 2016-05-17 18:22:43 +0800

Princenuk gravatar image Princenuk
29 5

updated 2016-05-17 18:24:43 +0800

I am currently using this textbox constraint to allow 6 figure numbers with up to 3 decimal places.

<textbox  id="bal" maxlength="11"  constraint="/^[0-9]{1,6}(?:[.][0-9]{1,3})?$/"/>

So I can enter up to 999999.999. However, I want to allow for a $ sign to be entered before the number. How do I add that to the constraint?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-05-18 09:39:34 +0800

IngoB gravatar image IngoB flag of Germany
256 6

updated 2016-05-18 09:40:51 +0800

How about this? It is optional to enter a dollar sign in front:

^\$?[0-9]{1,6}(?:[.][0-9]{1,3})?$

if it should always be in front, just remove the "?"

link publish delete flag offensive edit

Comments

Thanks, Just what I needed.

Princenuk ( 2016-05-18 14:54:06 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2016-05-17 18:22:43 +0800

Seen: 16 times

Last updated: May 18 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More