I'd like to find all occurrences of strings in a long string which are placed between a set of two specific strings.
For eg.
String s = "abcdText('hello')abcd efghText('world')";
The regex pattern of strings would be Text('
and next '
and the results should be the List of strings enclosed between the pattern. Hence the expected output should be:
[hello, world]
EDIT
String myString = "abcdText('hello')abcd efghText('world')";
RegExp exp = RegExp(r"Text\('(.*?)'\)");
List<String> _list =[];
for (var m in exp.allMatches(myString)) {
_list.add(m[1].toString());
}
print(_list);