Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      The Screen
         Display Commands
         Horizontal Scrolling
         Windows
         . . .
         The Bell
      Buffers and Files
         . . .
         Unicode Features
         Printing
         Extended file patterns
         Directory Editing
         Buffer List Editing
      Starting and Stopping Epsilon
         Session Files
         File Associations
         Sending Files to a Prior Instance
         MS-Windows Integration Features
      . . .

Previous   Up    Next
Printing  Commands by Topic   Directory Editing


Epsilon User's Manual and Reference > Commands by Topic > Buffers and Files >

Extended file patterns

This section describes Epsilon's extensions to the rules for wildcard characters in file names. You can specify more complicated file name patterns in Epsilon than Windows or Unix normally allow, using the wildcard characters of square brackets [], commas, semicolons, and curly braces {}. Epsilon also lets you use the * and ? characters in more places. These patterns work in the grep command, the dired command, and in all other places where file name wildcards make sense. (They don't work with Internet URLs, though.)

First, you can put text after the standard wildcard character * and Epsilon will match it. In standard DOS-style patterns, the system ignores any text in a pattern between a * and the end of the pattern (or the dot before an extension). But in Epsilon, ab*ut matches all files that start with ab and end with ut. The * matches the dot character in file names, so the above pattern matches file names like about as well as absolute.out. (Use ab*ut. to match only files like the former, or ab*.*ut to match ones like the latter.)

Instead of ? to match any single character (except dot, slash, or backslash), you can provide a list of characters in square brackets (similar to the regular expression patterns of searching). For example, file[0123456789stuvw] matches file4, file7, and files, but not filer. Inside the square brackets, two characters separated by a dash represent a range, so you could write the above pattern as file[0-9s-w]. A caret character ^ just after the [ permits any character but the listed ones, so fil[^tm]er matches all the files that fil?er matches, except filter and filmer. (To include a dash or ] in the pattern, put it right after the [ or ^. The pattern [^-]] matches all characters but - and ].)

You can use ? and * (and the new square bracket syntax) in directory names. For example, \v*\*.bat might match all .bat files in \virtmem and in \vision. Because a star character never matches backslash characters, it would not match \vision\subdir\test.bat.

The special directory name ** matches any number of directory names. You can use it to search entire directory trees. For example, \**\*.txt matches all .txt files on the current drive. The pattern **\include\*.h matches all .h files inside an include directory, looking in the current directory, its subdirectories, and all directories within those. A pattern ending in ** matches all files in that hierarchy. You can set the file-pattern-ignore-directories variable to have Epsilon skip over certain directories when expanding **.

The simplest new file pattern character is the comma. You can run grep on the file pattern foo,bar,baz and Epsilon will search in each of the three files. You can use a semicolon in place of a comma, if you want.

A segment of a file pattern enclosed in curly braces may contain a sequence of comma-separated parts. Epsilon will substitute each of the parts for the whole curly-brace sequence. For example, \cc\include\c*t.{bat,txt} matches the same files as \cc\include\c*t.bat,\cc\include\c*t.txt. A curly-brace sequence may not contain another curly-brace sequence, but may contain other wildcard characters. For example, the pattern {,c*\}*.{txt,bat} matches .txt and .bat files in the current directory, or in any subdirectory starting with "c". The brace syntax is simply a shorthand for the comma-separated list described above, so that an equivalent way to write the previous example is *.txt,c*\*.txt,*.bat,c*\*.bat. Epsilon breaks a complete pattern into comma-separated sections, then replaces each section containing curly braces with all the possible patterns constructed from it. You can use semicolons between the parts in braces instead of commas if you prefer.

To match file names containing one of the new wildcard characters, enclose the character in square brackets. For example, the pattern abc[}] matches the file name abc}. (Note that legal DOS file names may not contain any of the characters [],;, but they may contain curly braces {}. Other file systems, including Windows VFAT, Windows NT's NTFS, most Unix file systems, and OS/2's HPFS, allow file names that contain any of these characters.)

Use curly braces to search on multiple drives. {c,d,e}:\**\*.txt matches all .txt files on drives C:, D:, or E:. Epsilon does not recognize the *, ?, or [] characters in the drive name.

When a file name contains a literal brace character, a comma, or one of the other characters used for extended wildcard patterns, you can surround it in quotes (") to tell Epsilon to treat it literally, not as a wildcard pattern. Or you can set the file-pattern-wildcards variable to disable the wildcarding function of specific characters. If your file names often contain commas, for instance, you may want to disable comma's wildcard function.

It's possible to make Epsilon ignore certain types of symbolic links (and similar Windows NTFS file system entities) when interpreting file patterns. For instance, you can keep a ** pattern from matching symbolic links to directories, only matching actual directories. See the file-pattern-rules variable.

Under Windows, file pattern matching also matches on the names of NTFS streams, and on the server and share names of UNC files. You can restrict server name matching to particular domains to speed it up on large networks; see the file-pattern-unc-domains variable.



Previous   Up    Next
Printing  Commands by Topic   Directory Editing


Lugaru Copyright (C) 1984, 2012 Lugaru Software Ltd. All Rights Reserved.