Insert commas into numeric field using regular expression

I need to take a number (9123456) and insert commas so that it looks like (9,123,456). I have it written in javascript for the client side but I need a vbscript version for the server-side and I have not used regular expressions in vbscript yet so I need some help.
idaltonAsked:
Who is Participating?
 
mgfranzConnect With a Mentor Commented:
No RegExp needed, just use FormatNumber;

<%
theNum = FormatNumber("9876543210", 0)
Response.Write theNum
%>

The "0" indicates the number of decimal places to write after the .
0
 
thunderchickenCommented:
If your local currency settings are for $

<%
  dim number
  number = 9123456
  Response.Write right(formatcurrency(number,0),len(formatcurrency(number,0))-1)
%>
0
 
idaltonAuthor Commented:
I don't want to rely on local settings. I would prefer to handle via regular expression logic.
0
 
mgfranzCommented:
Do you have to use a RegExp?
0
 
idaltonAuthor Commented:
this solution works fine. thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.