Obsidian Gallery use help

Things I have tried

Hi everyone

I would like to understand the use of plugin gallery parameters with some practical examples, I am not able to use regular expressions, so I will appreciate very much your help

path and name params use Regex expressions.


My problem:

I have some images in a folder named “ASSETS”, inside few other folders.


  1. How can I show only the contents of folder folder2?
  2. How can I show only the files which the name stars with “image” in folder1?
  3. Any suggestion for further use of the gallery params like filter by extension.

Thanks in advanced

I am having some trouble with this myself. I have some limited experience with regex, and they are a struggle for me, but I think I can answer your questions.

  1. To show all the images in a folder, you should be able to use only the path parameter, with the name parameter blank. So, assuming ASSETS is in your vault folder, path=ASSETS/folder1/ should work.

  2. Setting the path parameter to folder1, as we just did in answer 1, try ^image.* in the name field. ^ means beginning of line, and .* basically means almost anything: the . stands in for any character except newline, and * means zero or more repetitions of the previous character. So .* is basically Godzilla; it matches any string from null to infinitely long. This can be a disastrous thing to do, but in this limited circumstance it seems like the easiest way to go. Especially if you don’t know anything about regex.

NOTE: I have had some luck with a regex like .*WORD.*, where WORD is a keyword in the filename. So if you had a bunch of pictures of frogs with frog in the title, .*frog.* would return all of them.

  1. You can filter by extension with .*\.xxx, where xxx is the extension you are after. The \ allows you to search for a literal period. So if you are looking for jpgs: .*\.jpg will get them.

Bear in mind, regexes have to be matched to the data you’re working with, so if you have a file like frog.jpg.jpg, this might not work. In that case, you could add $ to the end of your regex, which will anchor your pattern to the end of the string, just as ^ anchored the pattern to the beginning of the line in answer two. Carefully naming your files is the secret to not getting off into the regex deep end, which is indeed rather deep, especially if you haven’t worked with them before.

Regex101 is a good website to check out. You can enter strings and regexes, and it will tell you when they match, and give you notes on how they are working and how to improve them.

Best of luck! I’d be eager to know how it works out for you.


1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.