Piyush
Piyush

Reputation: 193

Remove text between parentheses in dart/flutter

Looking for RegExp to remove text between parentheses in dart/flutter. For example

Input...

Test Message (To Be removed)

Output

Test Message
String str = "Test Message (To Be removed)";
str.replaceAll(RegExp(<regular-expression>), '');

Upvotes: 3

Views: 2393

Answers (2)

Piyush
Piyush

Reputation: 193

Another RegExp

RegExp(r'\((.*)\)')

Upvotes: 0

Chirag Sondagar
Chirag Sondagar

Reputation: 619

Hi You can use this RegExp

String str = "Test Message (To Be removed)";
var test = str.replaceAll(RegExp('\\(.*?\\)'), '');
print(test);

Upvotes: 9

Related Questions