Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Remove parenthesis and Characters inside it

I want to remove parenthesis along with all the characters inside it…

var str = B.Tech(CSE)2020;

print(str.replaceAll(new RegExp('/([()])/g'), '');

// output => B.Tech(CSE)2020
// output required => B.Tech 2020

I tried with bunch of Regex but nothing is working…

I am using Dart…

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Your Dart syntax is off, and seems to be confounded with JavaScript. Consider this version:

String str = "B.Tech(CSE)2020";
print(str.replaceAll(RegExp(r'\(.*?\)'), " "));  // B.Tech 2020
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading