I just wanted to download a YouTube video using youtube-dl, however, zsh interprets the questionmark ? (which separates the query part of the URL) as a globbing wildcard operator (which matches any single character) and thus it aborts the command with the following error message:

$ youtube-dl https://www.youtube.com/watch?v=eDSESarTQXk
zsh: no matches found: https://www.youtube.com/watch?v=eDSESarTQXk

Is there a way to make zsh recognize URLs, perhaps using regular expression, so that it doesn’t try to glob them?

  • 1
    FWIW, this issue is nothing specific to Zsh or a specific video on massage techniques. The core problem here is solved by placing the URL in quotes. Same issue exists in Bash, Ksh, Sh and others. – JakeGould Oct 4 '15 at 18:45
  • @JakeGould: I don't remember having to do that when I used oh-my-zsh, however, I can’t find the particular setting and was hoping that someone knew it off the top of their head. Perhaps they've just disabled the ? globbing wildcard operator? – Lenar Hoyt Oct 4 '15 at 19:42
  • “Perhaps they've just disabled the ? globbing wildcard operator?” That is a case of using a sledgehammer when a light push would work. Never change core behavior like that for a one-case use. – JakeGould Oct 4 '15 at 19:53

You could disable the NOMATCH" option of zsh:


While the NOMATCH option is enabled (which is the default) zsh prints an error message if a pattern does not match a filename. By disabling NOMATCH, patterns that do not match a filename are kept unchanged in the argument list.

Note that the name of the option is really NOMATCH, so you have to use NO_NOMATCH to disable it, setting MATCH does not work.

Attention: This affects all globbing, not just URLs. So if you rely in any way on zsh returning errors when patterns do not match, this is not the way to go. (Sadly, unlike with NULL_GLOB there is no glob qualifier that allows enabling/disabling NOMATCH per case.)

  • 2
    +1 for explaining the consequences of NOMATCH, although I think your answer should have been posted to the duplicate question. And one remark: You can at least disable the NOMATCH behavior temporary with the noglob command, e.g. noglob youtube-dl url?foo=bar – mpy Oct 5 '15 at 18:58
  • A much better solution is to automatically quote URLs: superuser.com/a/1237124/93988 – Lenar Hoyt Sep 18 '17 at 23:42

You can put the URL in quotes, and it works.

$ youtube-dl 'https://www.youtube.com/watch?v=eDSESarTQXk'
[youtube] eDSESarTQXk: Downloading webpage
[youtube] eDSESarTQXk: Downloading video info webpage
[youtube] eDSESarTQXk: Extracting video information

Not the answer you're looking for? Browse other questions tagged or ask your own question.