I'd like to remove whole string if the string inside brackets has the word ppm
. Simply remove whole bracket if the word ppm
inside. How do I do this?
"Menthol(0.3ppm)" ===> "Menthol"
"Michale(36 years old man)" ===> "Michale(36 years old man)"
"Good(5%, 5,500ppm)" ===> "Good"
What I tried
str.replace(/\(.+?ppm\)/gim, '')
It works if the word ppm
is located in end of brackets, but not working if ppm
is located in first or middle of string.
"abcd(333ppm)" ===> "abcd" (OK)
"abcd1234(abc 333ppm)" ===> "abcd1234" (OK)
"abcd(333ppm, 30%)" ===> "abcd(333ppm, 30%)" (NOT OK)