Back

Regex Find from String/Html

Copy Below Code View As A Text File Show Text Only Show API Edit Code
                            

$text = 'Rate: $715/Month , Number of Stalls: 12'; $matches = array(); // returns all results in array $matches preg_match_all('/Number of Stalls: [0-9]{4}|Number of Stalls: [0-9]{3}|Number of Stalls: [0-9]{2}|Number of Stalls: [0-9]{1}/', $text, $StallMatchArr); preg_match_all('/Rate: \$[0-9]{4}\/Month|Rate: \$[0-9]{3}\/Month|Rate: \$[0-9]{2}\/Month|Rate: \$[0-9]{1}\/Month/', $text, $boardingMatchArr); $StallMatchArr = $StallMatchArr[0]; $boardingMatchArr = $boardingMatchArr[0]; cp($boardingMatchArr); cp($StallMatchArr,'c'); cp($boardingMatchArr); exit;