pathToRegExp static method
Implementation
static String pathToRegExp(NPage page, List<String> parameters) {
final path = page.fullPath;
final allMatchs = _regM.allMatches(path).toList();
page._matchs = allMatchs;
var start = 0;
final buffer = StringBuffer();
buffer.write('^');
for (var m in allMatchs) {
if (m.start > start) {
buffer.write(RegExp.escape(path.substring(start, m.start)));
}
final name = m[1];
buffer.write(r'(\w+)');
parameters.add('$name');
start = m.end;
}
if (start < path.length) {
buffer.write(RegExp.escape(path.substring(start)));
}
return buffer.toString();
}