tomasd Posted September 9, 2008 Share Posted September 9, 2008 Hi, I have 2 regex patterns I want to check against $data. What is the correct way of doing this? I'm trying this; <?php // regex_price.php function regex_price($data) { $preg_pattern_price = '/FareAdult([\d.]+)/'; preg_match_all($preg_pattern_price, $data, $result_price, PREG_PATTERN_ORDER); //Check if price is found under OFFERAdult if(empty($result_price)){ $preg_pattern_price = '/OFFERAdult([\d.]+)/'; preg_match_all($preg_pattern_price, $data, $result_price, PREG_PATTERN_ORDER); } $result_price = $result_price[1]; return ($result_price); } ?> but no joy. Any help appreciated! Link to comment https://forums.phpfreaks.com/topic/123429-please-help-with-preg_match_all/ Share on other sites More sharing options...
revraz Posted September 9, 2008 Share Posted September 9, 2008 Probably get a better answer in the regex forum http://www.phpfreaks.com/forums/index.php/board,43.0.html Link to comment https://forums.phpfreaks.com/topic/123429-please-help-with-preg_match_all/#findComment-637470 Share on other sites More sharing options...
tomasd Posted September 9, 2008 Author Share Posted September 9, 2008 Thanks I'll have a go there too, the reason I posted here was because I don't need any help with regex syntax, I just want to check few patterns Link to comment https://forums.phpfreaks.com/topic/123429-please-help-with-preg_match_all/#findComment-637474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.