AngularBoy AngularBoy - 3 months ago 16
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;