INNER CODE UNIT · Dart
regexp
TerminalStudio/xterm.dart · bin/xterm_bench.dart:14
final regexp = RegExp(
r'[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)',
);
bench('search $lines line', () {
var count = 0;
for (var line in terminal.lines.toList()) {
final matches = regexp.allMatches(line.toString());
count += matches.length;
}
print('count: $count');
});
}
void bench(String description, void Function() f) {
final sw = Stopwatch()..start();
f();
print('$description took ${sw.elapsedMilliseconds}ms');