Home > Net >  Remove text between parentheses in dart/flutter
Remove text between parentheses in dart/flutter

Time:01-07

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>), '');

CodePudding user response:

Hi You can use this RegExp

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

CodePudding user response:

Another RegExp

RegExp(r'\((.*)\)')
  •  Tags:  
  • Related