$re = '/(?<! - )((?:Jul|Aug)\W\d+\W+\d+)(?!.*(?:Jul|Aug)\W\d+\W+\d+)/m';
$str = 'Jul 31, 2015 - Aug 27, 2015 |
Itinerary # 1110473023685 Amman (AMM) ? Chicago (ORD) Jul 31, 2015 - Aug 27, 2015 , 1 round trip ticket
NOT BOOKED This flight is not booked. Book now to guarantee price and availability.
Traveler Information Adult No frequent flyer details provided
* Seat assignments, special meals, frequent flyer point awards and special assistance requests should be confirmed directly with the airline.
Jul 31, 2015 - Departure 2 stops Total travel time:20 h 40 m
Amman Paris 5 h 0 m 2,097 mi AMM 1:30am CDG 5:30am Terminal 2E Airport check-in with Air France Delta 8429 Operated by Air France Economy / Coach (B)
aris Amsterdam 1 h 15 m 247 mi CDG 8:45am Terminal 2F AMS 10:00am Delta 9429 Operated by KLM Economy / Coach (B) | Confirm seats with the airline
* Layover: 2 h 40 m
Amsterdam Chicago 8 h 30 m 4,112 mi AMS 12:40pm ORD 2:10pm Terminal 5 Delta 9382 Operated by KLM Economy / Coach (B) | Confirm seats with the airline
* Aug 26, 2015 - Return 1 stop Total travel time:19 h 0 m Chicago
Paris 8 h 15 m 4,148 mi ORD 5:20pm Terminal 5 CDG 8:35am +1 day Terminal 2E Air France 489 Economy / Coach (N) | Confirm seats with the airline
* Layover: 6 h 10 m Paris Amman 4 h 35 m 2,097 mi CDG 2:45pm Terminal 2E AMM 8:20pm (Arrives on Aug 27, 2015)
Air France 3840 Economy / Coach (N) | Confirm seats with the airline * Airline Rules & Regulations ·
This price includes a nonrefundable booking fee. ·
We understand that sometimes plans change. We do not charge a cancel or change fee. When the airline charges such fees in accordance with its own polic
ies, the cost will be passed on to you. ·
nonstop
Price Summary Traveler 1: Adult $1,901.20 Flight $1,267.00 Taxes & Fees $634.20 Expedia Booking Fee $7.00 Total: $1,908.20 All prices quoted in US dollars. ';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php