I have the following regex which is trying to parse price out of a string:
$pattern = '#([Ii][Dd][Rr].?\s*[0-9.,]+)|
([Rr][Pp].?\s*[0-9.,]+)|
([Pp][Rr][Ii][Cc][Ee]:?\s*[0-9.,]+)|
(\s[0-9]+\s?[Kk]\s)|
([0-9]+[Rr][Bb])|
([0-9.,]+\s*[Rr][Ii][Bb][Uu])|
(\b[0-9]+[.,][0-9]+[.,]?[0-9]+)#u';
$matches = array();
preg_match($pattern, $caption, $matches);
When tested with the following string:
"ABBY TOP
Colour : POLKA BLACK
Weight : 0,18
Price : 185,000
Material : Kaos Semi-Fleece
Size : Panjang / Length: 55 cm (depan), 72 (belakang)"
This always parses the 0.18
as the price, while I wanted the Price: 185,000
to be the real price.
Is there anything wrong in my regex?