bredom
2/23/2018 - 1:34 PM

Regular Expressions

Interesting reg exp tricks

<php

$reg = "/(\w+) or (\w+)/";
$rep = '${1} and ${2}';
$string = "Jack or Jill";
echo preg_replace($reg, $rep, $string);