ARTICLE AD BOX
I have been trying to figure out how to learn pregmatch and no matter what I try, it never works. I have tried my best until I get a migraine, searched all over the internet, and I hate to ask here since I will probably get verbally attacked for not knowing something, but I have no choice. The simple start of the text is:
Order Summary Order placed December 6, 2025I want to pull the date after Order placed I tried:
$datePattern = '/(?:Order placed)\s*(\w+\s\d{1,2},\s\d{4})/'; preg_match($datePattern, $text, $dateMatches);and it's not working. Or maybe it's easier to use a pregmatch that can capture the date? I mixed it up about 100 times and cannot get it to work.
OK, thanks to you guys the above does work. This new part doesn't work. The text is:
Estimated tax to be collected: $1.95 Gift Card Amount: -$7.29 Grand Total: $14.65 Delivered December 8 Your package was left near the front door or porch.I am using the code:
$totalPattern = '/(?:Grand Total:)\s*\$?(\d+\.\d{2})/'; preg_match($totalPattern, $text, $totalMatches);I am getting an empty result when trying to find the total after the word Grand Total: which in this example would be $14.65
