Forum Moderators: phranque
I am trying to get the data between all occurrences of "Apply for this position (" and the closing parentheses.
The first problem is that it only seems to be trying to find one match.
Second, it is returning an array with the full "Apply for this position (Truck Driver)" as $match[0] and the data I actually want "Truck Driver" as $match[1]
I would prefer to put only the data I need into the array so that it would look like:
$match[0] = Truck Driver
$match[1] = Machine Operator
and so on
My code is below, I have tried adding the g modifier, as well as preg_match_all to resolve the single match problem to no avail. I get an error stating unknown modifier g.
$regex = '/Apply for this position \((.+?)\)/';
preg_match($regex,$data,$match);
Thank you in advance for your time and help.