regex match specific letters and exclude rest of letter – PHP
$string='letters=ABCD'; We want to match "letters=" and letter B or C. The letter in string may input as: B C BC CB How to filter out A and D and output result as letters=BC ? preg_match('/(letters=([BC]+))/', $string,$matches); This match if…