preg_match_all regex and output

Posted under » PHP on 4 Sep 2020

Regex to look for blocks of string.

<¿php
$meh = file("custom_login_lms.txt");
$beh = $meh[0]; // 1st line only

$pattern = "/(Q[A-Z]+[0-1][A-Z]+[a-z]+[0-1][A-Z]+[A-z]+=)([b7].*4d)(ee.*a)/i";
if(preg_match_all($pattern, $beh, $matches)) {
print_r($matches);
 }
  
echo "one = ".$matches[1][0];
echo "two = ".$matches[2][0];
echo "three = ".$matches[3][0];

Read earlier Regex article.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data