+
+[ "$FILTER" ] && list_fex="$(
+ fex='p'
+ STRING "$FILTER^" \
+ | sed -r 's;\^;\n;g; s;[]\/\(\)\\\^\$\?\.\+\*\;\[\{\}];\\&;g' \
+ | while read -r f; do
+ [ ! "${f#~}" ] && continue
+ [ "${f#~}" = "$f" ] \
+ && fex="/(\ttags=([^\t]*,)?)(${f})((,[^\t]*)?\t)/{${fex}}" \
+ || fex="/(\ttags=([^\t]*,)?)(${f#~})((,[^\t]*)?\t)/d; ${fex}"
+ printf '%s\n' "${fex}"
+ done \
+ | tail -n1
+)"
+
+list_fullname(){
+ sn="$1"
+ [ ! "${sn%%*/*}" ] && base="${sn%/*}" || base=.
+ file="$(printf '%s' "$_DATA/$ITEM/$sn".*)"
+ file="${file##*/}"
+ [ -e "$_DATA/$ITEM/$base/${file}" ] \
+ && printf '%s\n' "${base}/${file}"
+}
+
+list_filter(){
+ if [ "$FILTER" ]; then
+ sed -nr "$list_fex"
+ elif [ "${SEARCH#!}" != "${SEARCH}" ]; then
+ grep -aviEe "$(STRING "${SEARCH}" \
+ | sed -r ':x s;((^|[^\\])(\\\\)*)\+;\1 ;g; tx;
+ s;((^|[^\\])(\\\\)*)\\\+;\1+;g;
+ s; ;\\+;g;')"
+ elif [ "${SEARCH}" ]; then
+ grep -aiEe "$(STRING "${SEARCH}" \
+ | sed -r ':x s;((^|[^\\])(\\\\)*)\+;\1 ;g; tx;
+ s;((^|[^\\])(\\\\)*)\\\+;\1+;g;
+ s; ;\\+;g;')"
+ else
+ cat
+ fi
+}
+
+list_order(){
+ local fm fn fn
+
+ if [ $ORDER = Name ]; then
+ sort -k6 |sed 's;^;metashort\t;;'
+ elif [ $ORDER = Length ]; then
+ sort -n -k1 |sed 's;^;metashort\t;;'
+ elif [ $ORDER = Date ]; then
+ while read -r fm; do
+ sn="${fm##* }"
+ fn="$(list_fullname "$(UNSTRING "${sn%${CR}}")")"
+ printf '%i %s %s\n' \
+ "$(stat -c %Y "$fn")" "${fm% *}" "$fn"
+ done \
+ | sort -rn -k1 |cut -f2- |sed 's;^;metalong\t;;'
+ fi