Created
December 16, 2019 19:38
-
-
Save MahmoudMabrok/c2c0ca775de8e0b34be63a476360c508 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
RegExp exp = new RegExp(r"[a-zA-Z]+"); | |
String str = "Parse my string"; | |
print('${getByToken(str, '[a-zA-Z]+')}'); | |
} | |
List<String> getByToken(var str , var token){ | |
RegExp exp = new RegExp("${token}"); | |
print('${exp.pattern}'); | |
Iterable<RegExpMatch> matches = exp.allMatches(str); | |
// print(matches.length); | |
var l = matches.map((t)=> t.group(0)).toList(); | |
// print(l.length); | |
return l; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment