I have the following code:
$string = "Manual balls knit cardigan @120rb
ORDER
BB 28AFF6A6 atau 25AE5DB3
Phone 081298249949 atau 081310570229
Line indy2212 atau indy2281
FORMAT
Nama
Alamat
Telp
Kode barang";
if (preg_match('/(?<= )@([^@ ]+)/', $string, $matches)) {
var_dump(count($matches));
var_dump('first ' . $matches[0]);
var_dump('second ' . $matches[1]);
}
However this results in $matches
to return an array of count 2. With the following string:
2
@120rb ORDER BB
120rb ORDER BB
My question is why? Why does it match the string twice? What is wrong with my regex