Regular Expressions in FTP search

We handle most of the ``extended'' Regular expressions as defined in POSIX 1003.2.

Some examples of mapping from the filename globbing performed by the unix shells (sh, bash, csh, tcsh) to regular expressions are shown here:

Globbing             Regexp

abc                  ^abc$
*abc*                abc
abc*                 ^abc
*abc                 abc$
abc*def.             ^abc.*def\.$
abc\*def.            ^abc\*def\.$
abc.def              ^abc\.def$
abc?def              ^abc.def$
abc\?def             ^abc\?def$
*.txt                \.txt$
{abc,def,ghi}        ^(abc|def|ghi)$
*{abc,def,ghi}*.txt  (abc|def|ghi).*\.txt$
*\[def*              \[def

Restrictions

Back references are not supported.
``basic'' regular expressions are not supported.
Very complex regular expressions (e.g. more than 8 OR terms by use of |) may cause fallback to brute force search which is very slow.
Some pathological regular expressions may cause significant slowdowns, due to the C library routine regexec using more than 1 CPU second for verifying each filename passed to it.
Some regular expressions are not allowed, due to the C library running out of memory when confronted with those expressions.

Zurück zur Suchseite