Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The regular expression that can be used to find all non-PDF files under a file path with a specific string, while excluding folders could be:

^(?!.*\/)[^.]+.((?i)(?

This regex will match any filename that does not have "pdf" as its file extension, does not start with a forward slash character "/" (to exclude folders), and contains the specific string that you are looking for.

Here's a breakdown of how the regex works:

  • ^(?!.*/): Asserts that the match starts at the beginning of the string and that there is no forward slash character "/" before the filename (negative lookahead).
  • [^.]+.: Matches one or more characters that are not a period, followed by a literal period character "." (to match the file extension).
  • ((?i)(?
  • [^.]+$: Matches one or more characters that are not a period until the end of the string (to match the filename).

Note that the specific string that you are looking for should be inserted into the regex where appropriate, replacing the "(?i)" in the regex.