Finding a regular expression in a string, then extracting it

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hame22
Forum Contributor
Posts: 214
Joined: Wed May 11, 2005 5:50 am

Finding a regular expression in a string, then extracting it

Post by hame22 »

Hi all

I have a number of strings and within these strings I want to extract any values that can be classed as money. The values will generally speaking be written like £750, £100000, £100,000, £150,755. Sometimes they may have full stops or other characters appended on their ends.

I want to be able to search for these money values then when I find them fully extract them so I can remove any commas and ensure they are formatted the same.

I am having trouble finding and extracting the values, what is the best route is this something I should use a reg expression for?

Any help will be mostly appricated

Thanks in advance!
Post Reply