···1717 } else if $list or ($function | is-empty) {
1818 print-functions
1919 } else {
2020- # Make sure the function is valid to avoid unhelpful error messages (doesn't check flags)
2121- if ($function | str replace -r " -.*" '') in (get-functions | append (get-aliases)) {
2020+ # Make sure the function is valid to avoid unhelpful error messages
2121+ # This regex checks if $function starts with anything in get-functions
2222+ if $function like $"^\(?:(get-functions | str join '|')\)" {
2223 nu -c $"/@AXR_LIB@/; atomic-xr ($function)"
2324 } else {
2425 log error $"Invalid function: `($function)`"