Regex by Default
Unlike find, which defaults to literal string or basic glob matching, fd treats the search pattern as a Regular Expression by default.
It uses the Rust regex crate, which provides syntax very similar to PCRE (Perl Compatible Regular Expressions)—the dialect most developers are already comfortable with.
The Power of Default Regex
Because regex is the default, you don't need wildcards (*) to perform partial matches.
# Matches "app.js", "apple.txt", "myapp.log"
fd app
If you want to use regex anchors and quantifiers, you can type them directly into the pattern:
# Find files that START with "test_" and END with ".py"
fd "^test_.*\.py$"
# Find files containing exactly three digits
fd "\d{3}"
The Pitfall of Default Regex
The downside to regex-by-default is that literal characters with special regex meanings (like ., +, ?, *, (, [) will be evaluated as operators, not literal strings.
For example, the dot . in regex means "match any character".
# You intend to find exact files named "app.js"
# But this ALSO matches "app-js", "appXjs", "app_js"
fd app.js
Fixing it: Escaping
To search for a literal dot, you must escape it with a backslash.
fd "app\.js"
Fixing it: Fixed String Mode (-g or -F)
If your search pattern contains many special characters (e.g., an IP address 192.168.1.1 or a complex C++ file name std::vector.hpp), escaping them manually is tedious.
You can disable regex and force fd to treat the pattern as a literal string or standard glob using the -g (glob) or -F (fixed-string) flags.
1. Glob Mode (-g, --glob)
Treats the pattern exactly like find -name. Requires explicit wildcards.
# Matches exactly "app.js" and nothing else
fd -g "app.js"
# Matches anything ending in ".js"
fd -g "*.js"
2. Fixed String Mode (-F, --fixed-strings)
Treats the pattern as an exact literal substring. No regex, no wildcards.
# Finds any file path containing the exact string "192.168.1.1"
fd -F 192.168.1.1
If your search term is just letters and numbers, use the default regex mode. If your search term contains dots, brackets, or plus signs, throw -g in front of it and use standard wildcards.