If locate suits you (it is fast, but only as good as the most recent run of sudo updatedb). You can run locate using its own built-in regex facility...
Here is a parameter driven script to do what you want. Call it with $1 as the "abcde" you are looking for and with subsequent parameters as the directories:
#!/bin/bash
a=("$@"); r=''
for ((i=1;i<${#a[@]};i++)); do r="$r|${a[i]}"; done
locate --regex "(${r:1}).*/[^/]*${a[0]}[^/]*$"
An example call looks like this:
$ ./script_name 'z' "$HOME/bin/perl" "$HOME/type/stuff"
As suggested by jasonwryan, here is a commented version of the script.
Bear in mind that locate always outputs fully-qualified paths.
#!/bin/bash
# Note: Do not use a trailing / for directory names
#
# Any of the args can be an extended regex pattern.
#
# Create an array `a` which contains "$1", "$2", "$3", etc... (ie. "$@")
# writing the $-args to an array like this (using quotes) solves
# any possible problem with embedded whitespace
a=("$@")
#
# Set up an empty string which is to be built into a regex pattern
# of all directroy names (or an appropriate regex pattern)
r=''
#
# Each regex pattern is to be an extended regex
# Each regex pattern is concatenated to the preceding one
# with the extended-regex 'or' operator |
#
# Step through the array, starting at index 1 (ie, $2),
# and build the 'regex-pattern' for the directories
for ((i=1;i<${#a[@]};i++)); do r="$r|${a[i]}"; done
#
# Run 'locate' with
# |the target file pattern $1 |
# |zero-to-| |preceded and followed by |
# |-many | |zero-to-many non-slash chars|
# |anything| | |‾‾‾‾‾‾‾‾‾‾‾‾
# ‾‾‾‾‾‾‾|| | |
locate --regex "(${r:1}).*/[^/]*${a[0]}[^/]*$"
# ________| | |
# |directory-regex| last
# | in brackets ()| slash
# |stripped of its|
# |leading "|" |
#