Skip to content

Commit 6b76be8

Browse files
Improve docs
1 parent 32c00d8 commit 6b76be8

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/file/match.cr

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,18 @@ class File < IO::FileDescriptor
1010
#
1111
# The pattern syntax is similar to shell filename globbing. It may contain the following metacharacters:
1212
#
13-
# * `*` matches an unlimited number of arbitrary characters, excluding any directory separators.
14-
# * `"*"` matches all regular files.
15-
# * `"c*"` matches all files beginning with `c`.
16-
# * `"*c"` matches all files ending with `c`.
17-
# * `"*c*"` matches all files that have `c` in them (including at the beginning or end).
18-
# * `**` matches directories recursively if followed by `/`.
19-
# If this path segment contains any other characters, it is the same as the usual `*`.
20-
# * `?` matches one arbitrary character, excluding any directory separators.
13+
# * `*`: Wildcard matches zero or more characters, except for directory separators.
14+
# * `**`: Globstar matches zero or more characters, including directory separators.
15+
# It must match a complete path segment, i.e. it must be wrapped in `/`
16+
# except for the beginning and end of the pattern.
17+
# * `?`: Matches a single Unicode character, except for directory separators.
2118
# * character sets:
22-
# * `[abc]` matches any one of these characters.
23-
# * `[^abc]` matches any one character other than these.
24-
# * `[a-z]` matches any one character in the range.
25-
# * `{a,b}` matches subpattern `a` or `b`.
26-
# * `\\` escapes the next character.
19+
# * `[abc]`: Character set matches one of the Unicode characters contained in the brackets.
20+
# * `[^abc]`: Negated character set matches any Unicode character _except_ those contained in the brackes.
21+
# * `[a-z]`: Character range matches one Unicode character contained in the character range.
22+
# * `{a,b}`: Branches matches one of the subpatterns contained in the braces. Subpatterns
23+
# may contain any other pattern feature, including nested branches (max nesting depth is 10 levels deep).
24+
# * `\\`: Backslash escapes the next character.
2725
#
2826
# If *path* is a `Path`, all directory separators supported by *path* are
2927
# recognized, according to the path's kind. If *path* is a `String`, only `/`

0 commit comments

Comments
 (0)