I am working on a personal project , where I want to get the file size information from a magnet link.
Problem: I wanna get 7.6GB from this string below.
0-%20Giri%20(2004)%5bTamil%201080p%20HD%20AVC%20-%20x264%20-%207.6GB%5d.mkv&tr=http%3a%2f%2fbt4
I am actually new to Regex btw.
Any kind help is appreciated.(i have googled for solution , no luck)
Edit: Thanks to Vishal Singh & Stackoverflow.
Here's the working code I have tried in dartpad♥️ , incase someone searching for answers in dart.
void main() {
RegExp exp = new RegExp(r"[0-9]+(\.[0-9])?(GB|MB|gb|mb)");
String str =Uri.decodeComponent(
"0-%20Giri%20(2004)%5bTamil%201080p%20HD%20AVC%20-%20x264%20-%207.6GB%5d.mkv&tr=http%3a%2f%2fbt4");
String match = exp.stringMatch(str);
print(match);
}
Output:
7.6GB