Skip to content
Advertisement

How to set filename mask in PhpStorm search to exclude Blade files

In my regular Laravel project I have both regular .php files with classes and .blade.php files for the templates of my project. When searching in PHPStorm with a file mask on, I have the option to filter with *.blade.php to only see my blade templates. But when I filter with *.php I find both .php files and .blade.php files because both file types end in a similar way. I would like to filter in such a way that only .php files are found, thus excluding Blade files in some way.

In the PHPStorm documentation I found the following relevant section: https://www.jetbrains.com/help/phpstorm/finding-and-replacing-text-in-project.html#exclude_type However, this documentation does not explicitly specify how to exclude files in this way.

What is the correct syntax to make this happen?

(As of this writing, no Stackoverflow questions have been asked yet featuring this specific php/blade file mask use-case.)

Advertisement

Answer

The correct syntax is as follows:

*.php,!*.blade.php

Explanation:

  • The comma separates the file types
  • The exclamation mark negates/excludes that specific result

You can find more information on the available wildcards here: https://www.scootersoftware.com/v4help/index.html?file_masks.html

Relevant part from that link:

Wildcards

Wildcards allow a file mask to match multiple folder or file names.

  • ? Matches any single character.
  • * Matches zero or any other amount of characters.
  • [az] Matches any single character in the set (a or z).
  • [a-z] Matches any single character in the range (from a to z).
  • [!az] Matches any single character not in the set (not a and not z).
  • [[] Matches a single [ character.
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement