improved regex to use with paths

This commit is contained in:
skilion 2015-09-19 14:21:33 +02:00
parent 5c6ed227a7
commit f0c12e4002

View file

@ -48,7 +48,7 @@ string wild2regex(const(char)[] pattern)
{
string regex;
regex.reserve(pattern.length + 2);
regex ~= "^";
regex ~= "(^|/)";
foreach (c; pattern) {
switch (c) {
case '*':
@ -61,7 +61,7 @@ string wild2regex(const(char)[] pattern)
regex ~= ".";
break;
case '|':
regex ~= "$|^";
regex ~= "$|(^|/)";
break;
default:
regex ~= c;