mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-04 23:12:18 +02:00
improved regex to use with paths
This commit is contained in:
parent
5c6ed227a7
commit
f0c12e4002
|
@ -48,7 +48,7 @@ string wild2regex(const(char)[] pattern)
|
||||||
{
|
{
|
||||||
string regex;
|
string regex;
|
||||||
regex.reserve(pattern.length + 2);
|
regex.reserve(pattern.length + 2);
|
||||||
regex ~= "^";
|
regex ~= "(^|/)";
|
||||||
foreach (c; pattern) {
|
foreach (c; pattern) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '*':
|
case '*':
|
||||||
|
@ -61,7 +61,7 @@ string wild2regex(const(char)[] pattern)
|
||||||
regex ~= ".";
|
regex ~= ".";
|
||||||
break;
|
break;
|
||||||
case '|':
|
case '|':
|
||||||
regex ~= "$|^";
|
regex ~= "$|(^|/)";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
regex ~= c;
|
regex ~= c;
|
||||||
|
|
Loading…
Reference in a new issue