Hi,
Yep, make pDp = 2 for 2 decimal places.
\d means a decimal character in regular expression syntax, but as it's being passed to the expressions constructor as a string, it needs to be escaped and hence becomes \\d.
new RegExp creates a regular expression object and test is one of it's methods/functions - well worth checking out if you're going to do much in the way of string manipulation or validation.
Cheers,
Chris
|