Example strings:
$string = "Buyer must enter coupon code 10OFF100 in shopping cart.";
$string = "Get $20 Off Auto Parts Order Over $150. Use Coupon code: GAPCJ20";
I need to extract the codes (10FF100
and GAPCJ20
).
I was trying to create a preg_match
to find "coupon code" and "coupon code:" and extract the phrase or word immediately after. Not having much luck myself or finding the reg expression.
Can some post the proper code please.
Thanks for the help.