AngularBoy AngularBoy - 19 days ago 4
Javascript Question

how do i remove specific letters from alphabet string using regex

I have the alphabet as an uppercase string.

How do I remove the letters B G R P? I am using JavaScript.

I have tried:

replace(^/B/G/R/P/g, "")
replace(^[B,G,R,P]/g, "")


in php, would be somthing like this -

$remove = preg_replace('/[BGRP]/', '', $string); 
// new string 
echo $remove;