JavaScript: Remove everything inside parenthesis

Using JavaScript, how can I remove everything between ( and ) ?
LVL 16
hankknightAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
kivan24Connect With a Mentor Commented:
<script language="JavaScript">
var str='Lorem (ipsum dolor) sit amet, (consectetur adipiscing) elit. Aenean (aliquet leo eu) nisl egestas vulputate.';
document.write(str);
document.write("<hr>");

// Regexp
var result = str.replace(/\(.*?\)/g, "");

document.write(result);
</script>
0
 
R-ByterConnect With a Mentor Commented:
Is this what you want?

var sentence = "This is (not) content".replace(/\([a-z0-9\ ]+\)/g,'');

Open in new window


Regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.