Jump to content

I want to get the numbers only and omit the commas


Jarod

Recommended Posts

Well I give up on this... Even though I learned a lot about regex, but forget it... Anyways, I've been trying to figure out how I would handle my inputs so that it only looks at the numbers and nothings else.

 

Check out 900,000,000,000 for example (900 billions btw). I enter it exactly as, but when it comes down for processing it I only want the numbers to go through, which would be 900000000000. I've heard of regex before, but never actually understood its purpose and how its suppose to be used. So anyways I used the expressions /[0-9]{1,3}[^,]*/, but the problem of that is I cant get it to only look at the numbers (omitting the commas and only using the numbers). Its array would output

 

Array [0] (

$match[0] = 900;

$match[1] = 000;

$match[2] = 000;

$match[3] = 000;

)

 

Any way I can get it to look at the string like this??? (900000000000)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.