Reputation: 363
This Regex below works well for all currencies when testing on a Regex test page.
Although when in my page, it just works for the $ currency.
I changed the MetaTag for different caracter sets, no luck.
What could be wrong?
if (preg_match_all('([£€$¥]([ 0-9]([ 0-9,])*)(\.\d{2})?|([0-9]([0-9,]))(\.\d{2})?([pcm]|bn| [mb]illion))', $tout, $matches))
I want to extract any amount following (with ou without a space) any of the 4 Currencies signs.
Upvotes: 1
Views: 97
Reputation: 7941
The expression you are using is valid and seems to match the output as expected. That is, if the file is saved as UTF-8.
If the input is in different encoding, it will not work. Also, if the input indeed is UTF-8 but the source if is not, the regex would seem to fail as it would try to match different characters (the non UTF-8 encoding equivalents).
Upvotes: 1