Sample text:
1. Medium Size +CA $33.00
2. Small Size -CA $4.00
I would like the result to be just 'Medium Size' or 'Small Size' using preg_match
So the regex should detect the '-' or '+' sign and just give me the text output without the prices/currency
Tried
(\S+)
(\S+\s+)
This regexp should extract the title between the first field (
1.) and last two fields separated by spaces (+CA $33.00):/^\S+ (.+) \S+ \S+$/To capture all the titles at once, use
preg_match_all()andmflag: